Connected components#2269

Connected components

1 second
128 megabytes
Easy

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

Input

The first line contains the number of vertices (n \leq 100). Then follow lines with numbers each — the adjacency matrix of the graph. In the -th row, at the -th position, there is if vertices and are connected by an edge, and otherwise. The main diagonal of the matrix contains zeros. The matrix is symmetric with respect to the main diagonal.

Output

Print one integer — the number of connected components of the given graph.

Examples

Example 1

Loading
Loading