Legacy Code

No attempts yetTime limit1sMemory limit256 MB

Problem

Your software consists of packages and executables. Each method is Package::Method. Executables are packages whose method named PROGRAM starts running.

For every method you know which methods call it directly. A method is unused if no execution starting from any PROGRAM method can ever call it. Count unused methods.

Input

Line 1: integer NN (1N4001 \leq N \leq 400), the number of methods. Each method occupies two lines: identifier and caller count kik_i, then optionally kik_i caller identifiers.

Output

Print the number of unused methods.