Codeforces Round 243 (Div. 1)
D
Sereja and Squares
Codeforces
2300
原题
← CE →
翻译中…

Sereja has painted $*n*$ distinct points on the plane. The coordinates of each point are integers. Now he is wondering: how many squares are there with sides parallel to the coordinate axes and with points painted in all its four vertexes? Help him, calculate this number.

翻译中…

Input

翻译中…

The first line contains integer $*n*$ $(1 ≤ *n* ≤ 10^{5})$. Each of the next $*n*$ lines contains two integers $*x*_{*i*}, *y*_{*i*}$ $(0 ≤ *x*_{*i*}, *y*_{*i*} ≤ 10^{5})$, the integers represent the coordinates of the $*i*$-th point. It is guaranteed that all the given points are distinct.

翻译中…

Output

翻译中…

In a single line print the required number of squares.

翻译中…

样例

Input #1
5
0 0
0 2
2 0
2 2
1 1
Output #1
1
InputCopy OutputCopy
Input #2
9
0 0
1 1
2 2
0 1
1 0
0 2
2 0
1 2
2 1
Output #2
5
InputCopy OutputCopy
题目信息
题号
425D
时间限制
2 s
内存限制
512 MB
标签
二分
数据结构
哈希

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。