406178: GYM102302 C Rectangles

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Rectanglestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Sancho is a weird kid, he really likes rectangles. You are in charge of babysitting him and you want to keep Sancho distracted. You decided to give him a gridded sheet of paper with many dots in it, so that Sancho can draw a lot of rectangles by connecting those dots.

You don't want him to get overwhelmed with too many rectangles, so you want to know what is the number of distinct rectangles that can be formed such that each of the rectangle's vertexes is a dot, there are no dots inside or on the edges of the rectangle besides the ones on its vertexes and all sides are parallel to the axis of the grid.

Input

The first line of the input contains one integer $$$N$$$ $$$(1\leq N \leq 2000)$$$, indicating how many dots there are total in the sheet. $$$N$$$ lines will follow. The $$$i$$$th line will contain two numbers $$$x$$$ $$$(0 \leq x \leq 10^9)$$$ and $$$y$$$ $$$(0 \leq y \leq 10^9)$$$. The pair $$$(x, y)$$$ represents the coordinate of the $$$i$$$th dot on the sheet. No two dots will be in the same position.

Output

Output the number of distinct of rectangles that can be formed such that each vertex of the rectangle is a dot, there are no dots inside or on the edges of the rectangle besides the ones on its vertexes and each rectangle is parallel to the axis of the grid.

ExampleInput
6
1 1
1 2
2 1
2 2
3 1
3 2
Output
2

Source/Category

加入题单

上一题 下一题 算法标签: