# Depth First Search

# Gnomes and houses

Long time ago, in Berendeevy Polyany lived not schoolchildren and teachers, but gnomes. Since then, some of the houses are connected by underground tunnels. On this night, the gnomes planned to regain their ancient lands and capture all the LKSH houses while schoolchildren and teachers are asleep. Once in the house, the dwarfs can freely penetrate into any other connected with it tunnels, from it - into connected with it and so on. However, the teachers, having learned about this, closed the doors for the night. And now the dwarfs have to break some number of doors in order to grab the LKSH.

Imagine yourself at the dwarf's place and answer the question: how many doors they have to break?

#### Input

The first line contains the number of houses **n** (**1** ≤ **n** ≤ **100**) at LKSH. The next **n** lines give the description of tunnels in the form of a table – the cell [**i**, **j**] contains "**1**" if there exists the tunnel between the houses **i** and **j**, otherwise "**0**" is there.

#### Output

Print the minimum number of doors that the gnomes need to break.

6 0 1 1 0 0 0 1 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0

3