#icpc2013summerwarmingUpi. [icpc2013summer_warmingUp_i]Topology
[icpc2013summer_warmingUp_i]Topology
Description
KM discovered that the number of holes is very important for some geometrical problems. He wants to calculate the number of holes of various figures. To simplify this problem, he assumes that the figures are composed of some unit squares whose vertices are on lattice points.
He can calculate it when the number of the squares is small. He can't calculate it by hand when the number is large, so he asks you, the friend of him and the excellent programmer, to solve this problem by computers.
Figure 1: Holes
A hole is a bounded connected component when all squares are removed. When two components share some edges, they are considered connected.
Input
The first line of the input file contains (), which is the number of squares.
Each of the following lines describes a square by specifying integers and () separated by single blank characters. and are coordinates of the lower left corner.
You can assume that any two coordinates are different.
Output
Output the number of the holes that the figure has.
Sample Input
4
0 0
1 -1
2 0
1 1
Sample Output
1
Sample Input
16
1 0
3 0
5 0
0 1
2 1
4 1
1 2
3 2
4 2
1 3
5 3
0 4
1 4
2 4
4 4
3 5
Sample Output
3