## OCC '19 G4 - Willson and Fighting

View as PDF

Points: 30 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem types

Willson the Canada Goose is like any other Canada Goose - he can sometimes become upset with other geese (or humans) and begin to fight them. However, geese will never fight with their mates.

After migrating back from California, Willson's extended family, consisting of geese, are grazing in a field. The goose is located at , and no two geese will share the same location. Define the distance between the goose and the goose to be , that is, the Manhattan distance.

For , the and geese are mates. Suppose two geese and are mates. Then for any other goose , goose will honk at goose if . Similarly, goose will honk at goose if .

If two geese honk at each other, then they will fight once. Can you determine the number of fights that each goose will get into?

#### Constraints

All coordinates satisfy .

No two geese will share the same location.

#### Input Specification

The first line of input will contain .

lines of input follow. The line will contain integers .

#### Output Specification

Output lines. On the line, output the number of fights that goose will get into.

#### Sample Input

4
1 1
3 1
4 1
6 1
1 21
1 23
1 24
1 25

#### Sample Output

0
1
1
0
0
0
0
0

#### Explanation for Sample Output

Goose and goose will honk at each other, so they fight. Note that goose does not honk at goose , so these two geese do not fight.