Maomaochong likes to participate in CF, but it is very picky; it only likes to participate in contests where the difficulty is not lower than its current ability value.
Formally, let Maomaochong's ability value be $x$ (initially $x = 0$). There are $n$ contests, where the $i$-th contest has a difficulty $a_i$ and a hidden score $b_i$. Maomaochong will participate in the $i$-th contest if and only if its current ability value $x \le a_i$. After participating, its ability value will be updated to $\max(b_i, x)$.
You can arrange the order of the contests arbitrarily. What is the maximum number of contests Maomaochong can participate in?
Input
The first line contains an integer $n$ ($1 \le n \le 10^6$).
The next $n$ lines each contain two integers $a_i, b_i$ ($0 \le a_i, b_i \le 10^{18}$), representing the difficulty and hidden score of the $i$-th contest, respectively.
Output
An integer representing the maximum number of contests Maomaochong can participate in.
Examples
Input 1
10 19 18 6 15 5 8 4 20 18 3 16 9 0 7 5 17 2 13 15 17
Output 1
5