Time limit per test: 2.5 second(s) Memory limit: 262144 kilobytes
input: standard output: standard
Consider n distinct points on a plane.
Two points from that set are said to be friends, when there exists a rectangle with sides parallel to coordinate axes that contains those two points and doesn't contain any other point from the given set. A rectangle is said to contain a point if the point lies within the rectangle or on its border.
How many pairs of friends are there among the given points?
The first line of the input file contains an integer n, .
The next n lines contain two integers each, the coordinates of the given points. The coordinates don't exceed 109 by absolute value.
Output one integer number — the sought number of pairs of friends.
Codeforces (c) Copyright 2010-2019 Mike Mirzayanov