#K65117. Minimum Direct Invitations

    ID: 32127 Type: Default 1000ms 256MiB

Minimum Direct Invitations

Minimum Direct Invitations

You are given \( M \) friends, where each friend can directly inform a list of other friends. Once a friend is informed, they automatically pass on the information to everyone in their list. Your task is to determine the minimum number of direct invitations that must be sent initially such that every friend receives the invitation.

Formally, you are given a directed graph where each node represents a friend. If there is an edge from friend \( u \) to friend \( v \), it means that when \( u \) is informed, \( v \) will also be informed. A friend who does not have any incoming edge has to be directly invited. Compute the number of such friends.

inputFormat

The first line contains an integer \( M \) representing the number of friends.

The following \( M \) lines each describe a friend.

Each of these lines begins with the friend's name (a string without spaces) followed by an integer \( k \) indicating the number of friends they can inform. This is followed by \( k \) friend names.

Note: All friend names that appear in the list are among the \( M \) friends.

outputFormat

Output a single integer which is the minimum number of direct invitations needed, printed to standard output.

Make sure your program reads input from standard input (stdin) and writes the answer to standard output (stdout).

## sample
3
alice 2 bob charlie
bob 1 charlie
charlie 0
1