Tudor has decided to upload pictures of his goats to Instagram!
Tudor's goats are currently located at various lattice points in the -plane. To take pictures of his goats, Tudor will use a drone with a camera mounted on it. Tudor will send the drone to some point with and then take pictures of the goats from that location.
The camera that Tudor is using is a bit finicky - it can be set to focus on objects that are exactly units away, but when that happens, it can only take pictures of objects that are exactly units away. Since the location of the drone is fixed, if the camera needs to take a picture of an object that is a different distance away, it must be set to focus at the new distance.
The camera is smart enough to automatically take pictures of all objects of interest that are at its current focus distance. However, Tudor will need to manually instruct the camera on which distances to focus at. The camera initially has its focus distance set to zero.
Compute the minimum number of times Tudor will need to change the focus distance of the camera.
Constraints
All goats are at distinct points.
There is no partial credit available for this problem.
Input Specification
The first line of input will contain a single positive integer, .
Each of the next lines will contain two space-separated integers, and , indicating a goat is at .
Output Specification
Output, on a single line, the minimum number of times Tudor needs to focus the camera.
Sample Input
8
3 4
0 5
0 -5
5 0
-5 0
4 -3
3 -4
-4 3
Sample Output
1
Comments
how does adding a third dimension make a difference to the problem? Could someone explain to me why it the answer wouldn't be the same if the drone was also only on the x-y plane, with no height?
The focus distance is initially set to zero, which means that if it's hovering above the ground it cannot initially focus on a goat directly beneath itself.
oh i see thanks