题目描述
Problem Description
You are to compete against Tian Ji in a horse racing contest. Each of you has $N$ horses, and you will conduct $N$ rounds of races. In each round, both of you will send out one horse to determine the winner.
The speeds of your horses are $u_1, u_2, \cdots, u_n$, and the speeds of Tian Ji's horses are $v_1, v_2, \cdots, v_n$. Tian Ji will send out his horses in order. How should you arrange your horses to win the most number of rounds? It happens that all the speeds of your and Tian Ji's horses are distinct, so there will be no ties.
Input Format
The first line contains an integer $N$. It is guaranteed that $1 \le N \le 5 \times 10^4$.
The next line contains $N$ integers separated by spaces, $u_1, u_2, \cdots, u_n$, representing the speeds of your horses. It is guaranteed that $1 \le u_i \le 2N$.
The following line contains $N$ integers separated by spaces, $v_1, v_2, \cdots, v_n$, representing the speeds of Tian Ji's horses. It is guaranteed that $1 \le v_i \le 2N$.
Output Format
Output a single line indicating the maximum number of rounds you can win.
Sample Input and Output
Sample Input #1
3
1 3 5
2 4 6
Sample Output #1
2
Sample Input #2
5
10 3 5 8 7
4 6 1 2 9
Sample Output #2
5
Notes
Sample Explanation 1
In the first round, Tian Ji sends out the horse with speed 2, and you can send out the horse with speed 3, winning this round.
In the second round, Tian Ji sends out the horse with speed 4, and you can send out the horse with speed 5, winning this round.
In the third round, Tian Ji sends out the horse with speed 6, and you can send out the horse with speed 1, losing this round.
Thus, you can win 2 rounds.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分