시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 14 7 7 50.000%

문제

While browsing the internet, of course using Internet Explorer without any adblocker, you have noticed a number of interesting competitions advertised in the panels on various webpages. In most of these competitions you need to answer a simple question, like how many triangles/squares/rectangles there are in a picture, or even choose the right answer out of three possibilities. Despite the simplicity of the task, it seems that there are many valuable prizes to be won. So there is definitely something to compete for!

In order to increase your chances, you decided to write a simple program that will solve the problem for you. You decided to focus first on the question “How many squares are there in the picture?”, and to simplify the problem even more, you assume that the input picture consists only of a number of lines that are infinite in both directions. To be precise, we say that four lines ℓ1, ℓ2, ℓ3, ℓ4 in the picture form a square if lines ℓ1 and ℓ3 are parallel to each other and perpendicular to ℓ2 and ℓ4, and moreover the distance between ℓ1 and ℓ3 is the same as the distance between ℓ2 and ℓ4.

입력

The first line of the input contains a single integer n (1 ≤ n ≤ 2 000), denoting the number of lines in the input picture. Then follow n lines, each containing a description of one line in the input picture. The line is given as a pair of distinct points lying on it. That is, the description consists of four integers x1, y1, x2, y2, each of them of absolute value at most 10 000, such that the line passes through points (x1, y1) and (x2, y2). You may assume that points (x1, y1) and (x2, y2) are different, and also that all the lines in the picture are pairwise different.

출력

Output exactly one line with one integer, denoting the total number of squares formed by the lines in the picture.

예제 입력

10
0 0 1 0
0 1 1 1
0 2 2 2
0 0 0 4
1 -1 1 0
2 -2 2 2
1 1 2 2
1 1 0 2
3 1 2 2
1 3 0 2

예제 출력

6

힌트