You lead a team that inspects a newly built ski resort. The resort spans several mountains and is made up of a number of slopes. Slopes connect to one another, forking and joining, and the whole map is a directed acyclic graph: the vertices are points in the resort and every directed edge is a slope that always goes downhill.
Your team must inspect every slope. The lifts are not running yet, but you have a helicopter. On each flight the helicopter drops one inspector at any point of the resort. From that drop-off point the inspector skis downhill, inspecting every slope they ski down. A slope may be inspected more than once, but helicopter flights are expensive, so you must inspect all slopes using as few flights as possible.
Determine the minimum number of helicopter flights needed to inspect every slope.
The first line contains a single integer $n$ ($2 \le n \le 100$) — the number of points in the resort.
Each of the next $n$ lines describes one point, numbered from $1$ to $n$. The $i$-th of these lines begins with an integer $m_i$ ($0 \le m_i < n$), followed by $m_i$ distinct integers $a_{i,1}, \dots, a_{i,m_i}$ ($1 \le a_{i,j} \le n$, $a_{i,j} \ne i$): there is a slope going downhill from point $i$ to point $a_{i,j}$.
Every point has at least one slope connected to it.
Print a single integer — the minimum number of helicopter flights required to inspect all slopes.