Rectangles

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

An axis-parallel rectangle is a rectangle with sides parallel to the xx-axis or the yy-axis. Also its four vertices are different from each other.

For a set SS of points in the plane, an axis-parallel rectangle is called to be contained in SS if it has, as its vertices, four points belonging to SS.

For example, in the left of Figure J.1, a set SS of ten points is given in the plane. Then as the right of Figure J.1, there are three axis-parallel rectangles contained in SS.

Figure J.1 There are three axis-parallel rectangles contained in the given set of points.

Given a set SS of nn distinct points in the plane, write a program to output the number of all the axis-parallel rectangles contained in SS.

입력

Your program is to read from standard input. The input starts with a line containing an integer nn (1n70,0001 ≤ n ≤ 70\\,000), where nn is the number of points given in the plane. In the following nn lines, each line contains two integers that represent, respectively, the xx-coordinate and the yy-coordinate of a point. These coordinate values are between 00 and 10510^5 and all the given points are distinct.

출력

Your program is to write to standard output. Print exactly one line. The line should contain the number of axis-parallel rectangles contained in the given point set.