시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 36 19 12 42.857%

문제

당신은 웹 서핑을 하고 있었다. 당연히 광고 차단 기능도 없이, 그것도 인터넷 익스플로러로 말이다. 그러던 중 당신은 여러 개의 웹페이지에 올라온 광고 패널들에 재미있는 대회들이 광고된 것을 보게 되었다.

이 대회들은 대부분 간단한 질문에 답하는 형식이다. 예를 들자면 사진에 몇 개의 삼각형이나 정사각형, 직사각형이 있는지, 아니면 3개의 보기 중에서 정답을 고르는 문제 같은 것이다. 이렇게 간단한데도 불구하고 거기에는 좋은 상품들이 많이 걸려 있었다. 그러니 해볼 만 했다.

당첨될 기회를 높이기 위해서, 당신은 문제를 풀어 주는 간단한 프로그램을 만들기로 했다. 당신은 첫 번째 질문인, 사진 속에 몇 개의 정사각형이 있는지에 집중하기로 했고, 문제를 더욱 단순화하기 위해서 입력된 사진들은 선분이 아닌 직선만 포함하고 있으리라고 가정했다.

정의에 대해 좀 더 세밀하게 이야기하자면, 우리는 사진 속의 네 개의 직선 ℓ1, ℓ2, ℓ3, ℓ4들 중에서 ℓ1, ℓ3이 서로 평행하고, 이들이 ℓ2, ℓ4와는 수직이며, ℓ1과 ℓ3 사이의 거리가 ℓ2와 ℓ4 사이의 거리와 같을 때 이것이 정사각형을 이룬다고 말한다.

입력

첫 번째 줄에 사진 속의 직선의 개수를 의미하는 정수 n이 주어진다.  (1 ≤ n ≤ 2,000)

뒤의 n개의 줄에는 직선 각각에 대한 설명이 이어지는데, 직선들은 직선 위의 두 점의 좌표를 통해 주어지며, 구체적으로는 최대 10,000인 네 정수 x1, y1, x2, y2으로 주어진다. 이 직선은 (x1, y1)과 (x2, y2)를 지난다는 것이다.

두 점의 좌표는 다르다고 가정해도 좋다. 그리고 모든 직선은 다르다고 가정해도 좋다.

출력

그림 속의 직선들로 이루어진 정사각형의 개수를 한 개의 정수로 한 줄에 출력하라.

예제 입력 1

10
0 0 1 0
0 1 1 1
0 2 2 2
0 0 0 4
1 -1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