Page not loading? Try clicking here.
Placeholder

#8036
Subtask

Number of parallel line segments 1s 1024MB

Problems

There are N distinct points on a 2D plane.

Connecting two distinct points among them via the shortest distance forms a line segment.

Write a program that outputs the number of line segments parallel to the x-axis or y-axis among the line segments that can be formed this way.

Here, the term "parallel" is used to mean having the same slope.


Input

The first line contains an integer N. (1 \le N \le 200,000)

The following N lines contain the x and y coordinates of each point. (-10^9 \le x,y \le 10^9)


Output

In the first line, print the number of segments parallel to the x-axis or y-axis among the segments formed by connecting two distinct points.

Hint: Since the answer may exceed the range of a 32-bit integer, it is recommended to use data types such as long long in C/C++ and long in Java.


Subtask

# Score Condition
#115

1 \le N \le 2,000

#225

-10^3 \le x,y \le 10^3

#360

No additional constraints


Example #1

5
2 4
3 3
1 3
2 1
1 1
4

Example #2

4
1 0
2 0
3 0
4 0
6


Source

klee

You must sign in to write code.