Lands of Antarctica
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Dots on the map of Antarctica shows the n polar stations, each of which has natural coordinates in a rectangular grid. The transition between the two stations is possible if the distance between them in a straight line less than two unit segments of the map. Stations, between which there exists a direct or indirect paths, are united into the land. Each station belongs to one land only.
You must find the number k of Arctic lands.
Input
The first line contains the number n of stations. Each of the next n lines contains two numbers - the coordinates of each station. All values are positive integers and do not exceed 100.
Output
Print the number of lands.
Examples
Input #1
Answer #1
Submissions 3K
Acceptance rate 57%