There are 2n soldiers standing in a double row: two rows, each with n 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.
The first line contains one integer n (1≤n≤50000).
The second line contains n integers x1,x2,…,xn (1≤xi≤100000) separated by single spaces, where xi is the height of the i-th soldier in the first row.
The third line contains n integers y1,y2,…,yn (1≤yi≤100000) separated by single spaces, where yi is the height of the i-th soldier in the second row.
It is guaranteed that every given input can always be set up properly.
Print a single integer: the minimum number of operations needed to set the soldiers up properly.
The figure below shows a double row of 18 soldiers. The arrows mark the swaps that rearrange them properly.
