시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 23 20 13 100.000%

문제

정사각형이란 네 변의 길이가 모두 같고, 네 각이 모두 직각인 사각형이다. 

어린왕자를 좋아하는 동혁이는 하늘을 바라보던 중, 네 별이 정사각형을 이루는 경우의 수가 궁금해졌다.

하늘은 2차원 평면으로 나타내며, 별의 위치는 x, y좌표로 나타낸다.

별의 위치가 주어졌을 때, 정사각형을 이루는 경우의 수를 출력하는 프로그램을 작성하시오. 

입력

입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 테스트 케이스의 첫째 줄에는 별의 개수 n(1 ≤ n ≤ 1000)이 주어진다. 

다음 n개의 줄에는 별의 x좌표와 y좌표가 공백으로 구분되어 주어진다. 별의 좌표는 중복되지 않으며, 원점과의 거리는 항상 20000보다 작다.

n=0인 경우 프로그램을 종료한다.

출력

각 테스트 케이스에 대해서 정사각형을 이루는 경우의 수를 출력한다.

예제 입력 1

4
1 0
0 1
1 1
0 0
9
0 0
1 0
2 0
0 2
1 2
2 2
0 1
1 1
2 1
4
-2 5
3 7
0 0
5 2
0

예제 출력 1

1
6
1
W3sicHJvYmxlbV9pZCI6IjQ4NjYiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWJjYzRcdWMwYWNcdWFjMDFcdWQ2MTUiLCJkZXNjcmlwdGlvbiI6IlxyXG48cD5cclxuXHRcdWM4MTVcdWMwYWNcdWFjMDFcdWQ2MTVcdWM3NzRcdWI3ODAgXHViMTI0IFx1YmNjMFx1Yzc1OCBcdWFlMzhcdWM3NzRcdWFjMDAgXHViYWE4XHViNDUwIFx1YWMxOVx1YWNlMCwgXHViMTI0IFx1YWMwMVx1Yzc3NCBcdWJhYThcdWI0NTAgXHVjOWMxXHVhYzAxXHVjNzc4IFx1YzBhY1x1YWMwMVx1ZDYxNVx1Yzc3NFx1YjJlNC4mbmJzcDs8XC9wPlxyXG5cclxuPHA+XHJcblx0XHVjNWI0XHViOWIwXHVjNjU1XH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