
Willson the Canada Goose is like any other Canada Goose - he likes to fly around and practice honking.
Today, he will be flying around a city containing
However, corners are dangerous for Willson to fly into - much more dangerous than walls. A corner is an integer coordinate where exactly
Could you tell Willson the number of corners that he needs to look out for?
Constraints
Subtask | Points | Coordinate limits | |
---|---|---|---|
1 | 30 | All coordinates satisfy | |
2 | 20 | All coordinates satisfy | |
3 | 30 | All coordinates satisfy | |
4 | 20 | All coordinates satisfy |
Note: Python users are recommended to submit with PyPy. Also, Python users are recommended to optimize their memory usage.
Input Specification
The first line of input will contain a single integer,
Output Specification
Output the number of corners that are formed by the buildings.
Sample Input
6
1 1 2 2
1 2 2 3
2 2 3 3
6 1 7 4
5 2 8 3
6 2 7 3
Sample Output
13
Explanation for Sample Output
In the following diagram, the buildings are shown in red and the corners are shown in the black circles.
Comments