cho.sh
Notes
Loading...

Axis-Parallel Lines

Time limit

2s

Memory limit

128 MB

Problem

There are n points on the plane. Count the number of lines that pass through at least two of the given points and are parallel to the x-axis or the y-axis. If the same coordinate pair appears multiple times, each occurrence is considered a distinct point.

Input

The first line contains the number of points n (1 <= n <= 100,000). Each of the next n lines contains two integers x and y, the coordinates of a point. The same coordinate pair may appear multiple times; each occurrence is considered a distinct point. Each coordinate is an integer with absolute value less than 2^31.

Output

Print the number of lines satisfying the condition.