#P6341. [COCI 2007/2008 #2] PRAVOKUTNI

[COCI 2007/2008 #2] PRAVOKUTNI

Problem Description

Given nn points on a plane, compute how many distinct right triangles have all their vertices 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 contains an integer nn, representing the number of points.

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

Output Format

Output the number of right triangles.

3
4 2
2 1
1 3
1
4
5 0
2 6
8 6
5 7
0
5
-1 1
-1 0
0 0
1 0
1 1
7

Hint

Constraints

For 100%100\% of the testdata, it is guaranteed that 3n15003 \le n \le 1500, the coordinate values are between 109-10^9 and 10910^9, and no two points have the same coordinates.

Notes

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

Translated by ChatGPT 5