406178: GYM102302 C Rectangles
Description
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.
InputThe 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.
OutputOutput 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.
ExampleInput6 1 1 1 2 2 1 2 2 3 1 3 2Output
2