#0003B5

Little Eugene

Little Eugene has bought a new juicer recently. Every morning his brothers, sisters and he drink fresh juice. And it, by the way, is very healthy. They understood, that they can drink juice made not just from one kind of fruits, for example orange, but also some mixes, like grape-apple. Everybody likes juice in Little Eugene's family, so they can drink more then one cup of different types of juice at morning. Little Eugene, as the most smart, makes juice for his family every morning. Lets describe the process of making juice: Little Eugene puts fruits into the juicer, mix them and collect juice into some container. The main problem is that sometimes this container have to be washed. For example, if he will make an apple juice after he made orange one, he'll get an apple-orange juice, instead of clear apple. More formally, let juice A contains from components a1,a2,a3..an and juice B - from b1,b2,b3..bm. We can make juice B after juice A only if B contains all the components of A (for every i there is at least one j that bj equal to ai). Otherwise container has to be washed before making juice B. Little Eugene do not like to wash container, so he wants to do it least possible number of times.
Help him to find the order of making juice.


InputThe first line consist of one integer - N (1<=N<=300), number of different types of juice that he wants to make.
Each of next N lines describes one juice. Describing of juice consist of number of components K (1<=K<=300) and the list of these components. Every component is a word with length at most 30 consist of english letters. Words are case sensitive (ApPLe and apple are different). Different components have different names.

OutputIn the only line output one integer, minimal number of times that Little Eugene have to wash container to make all the juices in some order. Consider, that he also have to wash container after last juice was made.


Input:
4
2 Orange Pineapple
1 Apple
1 Orange
2 Apple Orange

Output:
2
Description:
He makes the second, then the fourth types of juice. After that, he washes container.
He makes the third, then the first, and also washes container after it.

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.