P29350 [洛谷] [COCI2007-2008#2] RIGHT TRIANGLE
普及
题目描述

Problem Description

Given $n$ points in a plane, calculate how many distinct right triangles can be formed with vertices that are among the given points.

Two right triangles are considered different if and only if they have at least one different vertex.

Input Format

The first line of input contains an integer $n$, representing the number of points.

The next $n$ lines each contain two integers, representing the coordinates of a point.

Output Format

Output the number of right triangles.

Sample Input and Output

Sample Input #1

3
4 2
2 1
1 3

Sample Output #1

1

Sample Input #2

4
5 0
2 6
8 6
5 7

Sample Output #2

0

Sample Input #3

5
-1 1
-1 0
0 0
1 0
1 1

Sample Output #3

7

Notes

Data Size and Constraints

For $100\%$ of the data, it is guaranteed that $3 \le n \le 1500$, and the coordinates range between $-10^9$ and $10^9$. No two points have the same coordinates.

Notes

This problem is translated from COCI2007-2008 CONTEST #2 T6 PRAVOKUTNI.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 4 2 2 1 1 3
样例输出
1