CF425D.Sereja and Squares
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
输入格式
The first line contains integer n (1<=n<=105) . Each of the next n lines contains two integers xi,yi (0<=xi,yi<=105) , the integers represent the coordinates of the i -th point. It is guaranteed that all the given points are distinct.
输出格式
In a single line print the required number of squares.
输入输出样例
输入#1
5 0 0 0 2 2 0 2 2 1 1
输出#1
1
输入#2
9 0 0 1 1 2 2 0 1 1 0 0 2 2 0 1 2 2 1
输出#2
5