Double Row

No attempts yetTime limit3sMemory limit512 MB

Problem

There are 2n2n soldiers standing in a double row: two rows, each with nn soldiers, so every column holds two soldiers.

The soldiers are set up properly when, within each row, no two soldiers have the same height.

A single operation swaps the two soldiers that occupy the same column (one from each row). Determine the minimum number of such operations needed to set the soldiers up properly.

Input

The first line contains one integer nn (1n500001 \le n \le 50000).

The second line contains nn integers x1,x2,,xnx_1, x_2, \ldots, x_n (1xi1000001 \le x_i \le 100000) separated by single spaces, where xix_i is the height of the ii-th soldier in the first row.

The third line contains nn integers y1,y2,,yny_1, y_2, \ldots, y_n (1yi1000001 \le y_i \le 100000) separated by single spaces, where yiy_i is the height of the ii-th soldier in the second row.

It is guaranteed that every given input can always be set up properly.

Output

Print a single integer: the minimum number of operations needed to set the soldiers up properly.

Hint

The figure below shows a double row of 18 soldiers. The arrows mark the swaps that rearrange them properly.