Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Number of hanging vertices 1

Given a simple undirected unweighted graph. Count the number of hanging vertices in it. The vertex is hanging, if its degree is 1.

Input

The first line contains number n (1 ≤ n ≤ 1000). The next n lines contain the adjacency matrix.

Output

Print the number of hanging vertices in a graph.

Time limit 2 second

Memory limit 122.17 MiB

Input example #1

2
0 1
1 0

Output example #1

2

Input example #2

3
0 1 1
1 0 1
1 1 0

Output example #2

0