Connected components#502

Connected components

1 second
128 megabytes
Easy (≈1000)

The undirected unweighted graph is given. Find the number of its connected components.

Input

The first line contains the number of vertices n\:(n \le 100) in the graph. Then, in lines, an by matrix is given — the adjacency matrix of the graph. In the -th row, at the -th position, there is a if vertices and are connected by an edge, and if there is no edge between them. The main diagonal of the matrix contains zeroes. The matrix is symmetric with respect to the main diagonal.

Output

Print the number of connected components in a graph.

Examples

Example 1

Loading
Loading