beecrowd | 2652

How Many Trees?

By Abner Samuel P. Palmeira, IFSULDEMINAS BR Brazil

Timelimit: 1

A farmer was bored and so he decided to count how many species of trees existed on his farm, after hours trying to count he ended giving up because there were many trees on the farm.

Very frustrated he decided to call you to develop a program that counts how many different types of trees there are on the farm.

Two trees are the same if they have the same shape.

Input

The first line contains an integer N (1 ≤ N ≤ 40) representing how many trees there are on the farm. The next N lines begin with an integer M (1 ≤ M ≤ 40) representing how many vertices this tree has, followed by M-1 integers x2, x3 ...., xn integers representing one of the connections of these vertices from vertex two.

Output

Print how many different types of trees there are on the farm.

Input Sample Output Sample

3

6 1 4 2 2 2

6 1 4 2 2 4

6 1 6 6 2 2

2