## Mock CCC '19 Contest 2 S5 - Tudor Takes Pictures of Goats

View as PDF

Points: 15
Time limit: 0.6s
Memory limit: 1G

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 contains 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