AT_abc462_c [ABC462C] Not Covered Points

Description

There are $ N $ points numbered $ 1 $ through $ N $ on a two-dimensional plane. Point $ i $ $ (1\le i\le N) $ has coordinates $ (X_i,Y_i) $ . Here, it is guaranteed that $ X $ and $ Y $ are each permutations of $ (1,2,\ldots,N) $ . Find the number of values of $ i $ such that the interior (not including the boundary) of the rectangle with sides parallel to the $ x $ -axis and $ y $ -axis, with lower-left vertex $ (0,0) $ and upper-right vertex $ (X_i,Y_i) $ , contains none of the $ N $ points numbered $ 1 $ through $ N $ .

Input Format

The input is given from Standard Input in the following format: > $ N $ $ X_1 $ $ Y_1 $ $ X_2 $ $ Y_2 $ $ \vdots $ $ X_N $ $ Y_N $

Output Format

Output the answer.

Explanation/Hint

### Sample Explanation 1 The two values $ i=1,2 $ satisfy the condition. For $ i=3 $ , the interior (not including the boundary) of the rectangle with sides parallel to the $ x $ -axis, with lower-left vertex $ (0,0) $ and upper-right vertex $ (3,2) $ , contains point $ 1 $ . ### Constraints - $ 1\le N\le 3\times 10^5 $ - $ 1\le X_i,Y_i\le N $ - $ X $ and $ Y $ are each permutations of $ (1,2,\ldots,N) $ . - All input values are integers.