🏡 index : github.com/captn3m0/codechef.git

---
{"languages_supported":{"0":"NA"},"title":"RECTCNT","category":"NA","old_version":true,"problem_code":"RECTCNT","tags":{"0":"NA"},"layout":"problem"}
---

<h3> All submissions for this problem are available. </h3><p>Given N separate integer points on the Cartesian plane satisfying: there is no any three of them sharing a same X-coordinate. Your task is to count the number of rectangles (whose edges parrallel to the axes) created from any four of given points.
</p>

<h3>Input</h3>
<p>There are several test cases (ten at most), each formed as follows:
<ul>
<li>The first line contains a positive integer N (N  10<sup>5</sup>).</li>
<li>N lines follow, each containing a pair of integers (each having an absolute value of 10<sup>9</sup> at most) describing coordinates of a given point.</li>
</ul>
The input is ended with N = 0.
</p>

<h3>Output</h3>
<p>For each test case, output on a line an integer which is the respective number of rectangles found.
</p>

<h3>Example</h3>

<pre>
<b>Input:</b>
6
7 1
3 5
3 1
1 5
1 1
7 5
0

<b>Output:</b>
3
</pre>