시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 25 5 5 31.250%

문제

N(1≤N≤100,000)개의 선분이 주어졌을 때, 서로 겹치는 서로 다른 선분 쌍의 개수를 알아내는 프로그램을 작성하시오. 두 선분이 겹친다는 말은, 두 선분에 공통적으로 포함되는 점들이 무한 개 존재한다는 의미이다. 즉, 선분의 끝점만 닿아 있는 경우는 겹치는 경우가 아닌 것이다.

입력

첫째 줄에 정수 N이 주어진다. 다음 N개의 줄에는 각 선분의 양 끝점의 x, y좌표를 나타내는 네 정수가 주어진다. 각 좌표는 0이상 1,000,000의 값을 가지며, 한 선분의 양 끝점이 같은 경우는 주어지지 않는다.

출력

첫째 줄에 답을 출력한다.

예제 입력 1

3
1 1 2 2
2 2 3 3
1 1 3 3

예제 출력 1

2

힌트

W3sicHJvYmxlbV9pZCI6IjIwODAiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjYjlcdWNlNThcdWIyOTQgXHVjMTIwXHViZDg0IiwiZGVzY3JpcHRpb24iOiI8cD5OKDEmbGU7TiZsZTsxMDAsMDAwKVx1YWMxY1x1Yzc1OCBcdWMxMjBcdWJkODRcdWM3NzQgXHVjOGZjXHVjNWI0XHVjODRjXHVjNzQ0IFx1YjU0YywgXHVjMTFjXHViODVjIFx1YWNiOVx1Y2U1OFx1YjI5NCBcdWMxMWNcdWI4NWMgXHViMmU0XHViOTc4IFx1YzEyMFx1YmQ4NCBcdWMzMGRcdWM3NTggXHVhYzFjXHVjMjE4XHViOTdjIFx1YzU0Y1x1YzU0NFx1YjBiNFx1YjI5NCBcdWQ1MDRcdWI4NWNcdWFkZjhcdWI3YThcdWM3NDQgXHVjNzkxXHVjMTMxXHVkNTU4XHVjMmRjXHVjNjI0LiBcdWI0NTAgXHVjMTIwXHViZDg0XHVjNzc0IFx1YWNiOVx1Y2U1Y1x1YjJlNFx1YjI5NCBcdWI5ZDBcdWM3NDAsIFx1YjQ1MCBcdWMxMjBcdWJk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