eolymp
bolt
Try our new interface for solving problems
Problems

Number of loops

Number of loops

Simple directed graph is given by adjacency list. Find the number of loops in it.

Input

The first line contains the number of vertices n (1n100). Then n lines are given. The i-th line contains the description of all edges, outgoing from the i-th vertex. Description starts with the number of outgoing edges. Then given the vertex numbers where the edges go. All vertices are numbered from 1 to n.

Output

Print the number of loops in the graph.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3
2 2 3
0
1 3
Output example #1
1
Author Michael Medvediev