Time limit時間制限 : 1.5sec / Memory limitメモリ制限 : 96MB

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.

A hole is a bounded connected component when all squares are removed. When two components share some edges, they are considered connected.

Each of the following

You can assume that any two coordinates are different.

4 0 0 1 -1 2 0 1 1

1

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

3