Babel#2717

Babel

1 second
128 megabytes
Very easy

During the construction of the Tower of Babel, God mixed up all the languages. As a result, each person knows a certain set of languages. Two people can communicate if there is at least one language that both of them know. The construction manager gives commands in the languages he knows. Those who receive these commands can pass them on, translating them into the languages they know. Determine the number of people who receive the manager's command (including the manager himself).

Input

For convenience, all languages are numbered from to . The first line contains the number of people (1 \leq n \leq 100), followed by descriptions of the languages known by each person. For each person, first the number m_i (0 \leq m_i \leq 50) is given, representing the number of languages known by the -th person, then the numbers of these languages are given in increasing order (language numbers from to ). The manager is the person with number .

Output

Print the number of people to whom the manager's command can be transmitted (including the manager).

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading