F. Playwrite
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Willy Shakes was a prominent playwright, but many people never realized he had a very special process for writing 3-act plays. To streamline his writing, he would write many acts, then piece them together after the fact.

Willy would begin by writing $$$N$$$ acts. He would then rate each act on two metrics: comedy and tragedy. For act $$$i$$$, these ratings are given as two integers, $$$c_i$$$ and $$$t_i$$$. To make his plays exciting, he requires a very specific structure, in which each act is strictly more comedic and tragic than the previous.

He can pick any three acts that would follow this structure to make a play. Given the number of acts and the acts that he has written thus far, help Willy determine the number of $$$3$$$-act plays he can create.

Input

A single integer $$$1 \leq N \leq 10^5$$$.

$$$N$$$ lines, each containing a $$$c_i$$$ and $$$t_i$$$, where $$$1 \leq c_i, t_i \leq 1000$$$.

Output

A single integer, the number of $$$3$$$-act plays that can be made.

Example
Input
6
1 1
2 1
2 2
3 2
4 3
4 3
Output
6
Note

Make sure your values aren't overflowing :)