beecrowd | 1228
# Start Grid

**Timelimit: 1**

Maratona de Programação da SBC Brazil

Nlogonia will hold the sensational world final of the Formula 17 drivers championship. Competitors line up at the start and compete for the race. You will have access to the start and finish grids. The question is to determine the minimum number of overtakes that were made during the competition.

The input contains several test cases. Each test case uses three lines. The first line of a test case contains an integer **N** (2 ≤ **N** ≤ 24) indicating the number of competitors. Each competitor is identified by a number from 1 to **N**. The second line contains the **N** competitors in order of the starting grid. The third line of each case has the same competitors, but now in the order they finish the race.

For each test case print a line containing a single integer, the minimum number of overtakes necessary to get from the starting grid to the finishing grid.

Sample Input | Sample Output |

5 |
3 |