E. Er Wei Shu Dian
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

Urgent!!

The two great legends, Tseng and Chou, are debating the pronunciation of "Er Wei Shu Dian." You need to stop their quarrel in time; otherwise, the world would be diminished due to the disorder of the two great powers. In order to stand out from them, you must solve this variant of the classic "Er Wei Shu Dian" problem first.

Now, you are given $$$N$$$ points, the $$$i$$$-th point can be described by two integers ($$$x_i$$$, $$$y_i$$$), which means that the $$$i$$$-th point is placed at ($$$x_i$$$, $$$y_i$$$) on a 2D plane. For the $$$i$$$-th point, you need to find out how many points are strictly inside the upper-left corner and the upper-right corner. Since this is an urgent task, to save your time, you only need to output the sum of these values.

Input

The first line of the input contains a single integer $$$N$$$. Then, $$$N$$$ lines are provided, each containing two integers $$$x_i$$$ and $$$y_i$$$, representing the $$$i$$$-th point.

  • $$$1 \leq N \leq 3 \times 10^5$$$
  • $$$-10^9 \leq x_i, y_i \leq 10^9$$$
Output

Output a single line representing the answer.

Examples
Input
6
1 1
1 1
4 4
5 5
1 1
4 4
Output
11
Input
7
8 9
-1 -2
-3 -4
2 5
0 0
3 5
8 10
Output
19