시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB77151334.211%

문제

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
W3sicHJvYmxlbV9pZCI6IjIwODAiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjYjlcdWNlNThcdWIyOTQgXHVjMTIwXHViZDg0IiwiZGVzY3JpcHRpb24iOiI8cD5OKDEgJmxlOyBOICZsZTsgMTAwLDAwMClcdWFjMWNcdWM3NTggXHVjMTIwXHViZDg0XHVjNzc0IFx1YzhmY1x1YzViNFx1Yzg0Y1x1Yzc0NCBcdWI1NGMsIFx1YzExY1x1Yjg1YyBcdWFjYjlcdWNlNThcdWIyOTQgXHVjMTFjXHViODVjIFx1YjJlNFx1Yjk3OCBcdWMxMjBcdWJkODQgXHVjMzBkXHVjNzU4IFx1YWMxY1x1YzIxOFx1Yjk3YyBcdWM1NGNcdWM1NDRcdWIwYjRcdWIyOTQgXHVkNTA0XHViODVjXHVhZGY4XHViN2E4XHVjNzQ0IFx1Yzc5MVx1YzEzMVx1ZDU1OFx1YzJkY1x1YzYyNC4gXHViNDUwIFx1YzEyMFx1YmQ4NFx1Yzc3NCBcdWFjYjlcdWNlNWNcdWIyZTRcdWIyOTQgXHViOWQwXHVjNzQwLCBcdWI0NTAgXHVjMTIwXHViZDg0XHV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