RECTANGL  Rectangles
You are given a set S of N points in the plane and must count the number of distinct axisparallel rectangles whose four vertices all lie in S (that is, count those rectangles which have two sides parallel to the xaxis, and the other two sides parallel to the yaxis).
Input
The first line of the input is N (1 ≤ N ≤ 250000), the number of points in S. N lines then follow, where the ith line is of the form "x_{i} y_{i}", giving the coordinates of a point (x_{i}, y_{i}) in S. All given points are distinct, and all coordinates fit into a 32bit signed integer.
Output
Your output should consist of a single number, the number of distinct axisparallel rectangles whose four vertices all lie in S, followed by a newline.
Example
Input: 6 1 0 1 1 0 0 0 1 1 0 1 1 Output: 3
hide comments
Renzo:
20200515 16:54:29
Is the TL too strict?

Added by:  Minilek 
Date:  20071025 
Time limit:  1s4.273s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO NODEJS PERL6 VB.NET 
Resource:  MIT Individual Contest 2007 