Cards $1 \dots 2N$ are split: Elsie holds the $N$ cards listed (one per round, in the given order) and Bessie holds the rest. In each round the higher card scores a point. Knowing Elsie's whole sequence, print the maximum number of points Bessie can score.
Input
Line 1: $N$ ($1 \le N \le 50000$). Next $N$ lines: Elsie's cards, one per line.
Output
Print Bessie's maximum score.
Example 1
Input
3 1 6 4
Output
2
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.