SP1960 RECTANGL - Rectangles
Description
You are given a set _S_ of _N_ points in the plane and must count the number of distinct axis-parallel rectangles whose four vertices all lie in _S_ (that is, count those rectangles which have two sides parallel to the **x**-axis, and the other two sides parallel to the **y**-axis).
Input Format
The first line of the input is _N_ (1 ≤ _N_ ≤ 250000), the number of points in _S_. _N_ lines then follow, where the **i**-th 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 32-bit signed integer.
Output Format
Your output should consist of a single number, the number of distinct axis-parallel rectangles whose four vertices all lie in _S_, followed by a newline.