Trong trường hợp đề bài hiển thị không chính xác, bạn có thể tải đề bài tại đây: Đề bài
In the village of Chưng and Quýt, a concert was held, and to make the event vibrant and festive, the villagers used fireflies to illuminate the entire village. Each firefly is placed at a specific location in the village, represented by its coordinates ~(x,y)~. Chưng has placed ~n~ fireflies throughout the village.
Quýt knows that if the positions of any four fireflies form a square, the singer will perform even better. However, after Chưng has decorated the village, Quýt considers moving the fireflies around to optimize the concert's atmosphere. But there's a catch: if there are too many such squares, Quýt becomes lazy and doesn't want to make any changes at all, creating a dilemma.You can look at the picture above to understand better. You are given the coordinates of ~n~ fireflies on the map. Help Quýt determine how many squares can be formed by any set of four fireflies so she can make the right decision.
Input
The first line contains a positive integer ~n~ with ~(1 ≤ n ≤ 10^3)~ being the number of fireflies.
The next n lines each contain 2 numbers ~x, y~ being the coordinates of the fireflies in the village with ~(|x, y| ≤ 10^9)~.*
Output
Number of sets of 4 fireflies forming a square
Sample Input 1
8
2 2
2 4
2 6
4 2
4 4
6 2
6 6
5 5
Sample Ouput 1
2
Bình luận