Chinese Ink 

Lucca, my four-years-old daughter, loves drawing polygons in bond paper. For example, yesterday she drew two squares, a rectangle and two triangles:

\epsfbox{p11665a.eps}

Today, she wanted to fill her figures with black chinese ink. I helped her, obtaining the next result:

\epsfbox{p11665b.eps}

She asked me: how many black zones do you see?. I said: two. I'm bored answering the same question everyday. Can you help us writing a program that, given a collection of black filled polygons, determines the number of black zones on the drawing?

For a precise understanding: a black zone is a region of black coloured points on the sheet, where every pair of them may be connected by a continuous line within the region.

Input 

The input consists of several test cases. Each test case is represented as follows:

The end of the input is indicated when N = 0.

Output 

For each case in the input, print one line with the number of black zones in the drawing after filling each one of the polygons with black chinese ink.

Sample Input 

5
35 29 179 111 19 145
183 22 305 22 305 80 183 80
232 49 361 49 361 178 232 178
137 94 188 156 112 164
79 144 129 143 129 193 79 193
2
20 20 30 20 30 30 20 30
40 40 40 50 50 50 50 40
2
20 20 30 20 30 30 20 30
30 30 40 30 40 40 30 40
3
20 20 40 20 40 40 20 40
50 30 60 20 70 50
60 40 50 30 30 50
0

Sample Output 

2
2
1
1