Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Count Squares
Time Limit: 3000MSMemory Limit: 65536K
Total Submissions: 3114Accepted: 1384

Description

Given a set of points with integer coordinates xi, yi, i = 1...N, your program must find all the squares having each of four vertices in one of these points.

Input

Input file contains integer N followed by N pairs of integers xi yi.

Constraints

-104xi, yi ≤ 104, 1 ≤ N ≤ 2000. All points in the input are different.

Output

Output file must contain a single integer — number of squares found.

Sample Input

Sample input 1
4 0 0 4 3 -3 4 1 7
Sample input 2
9
1 1  1 2  1 3  
2 1  2 2  2 3  
3 1  3 2  3 3

Sample Output

Sample output 1
1
Sample output 2
6

Hint

Bold texts appearing in the sample sections are informative and do not form part of the actual data.

Source

Northeastern Europe 2005, Far-Eastern Subregion

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator