Tunnel

Given the entry order and exit order of N cars through a tunnel, count how many cars must have overtaken another car.

Medium4ArrayHash mapGreedyImplementationInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Mirko stands at the entrance of a tunnel and Slavko stands at the exit. Each of them writes down the licence plate of every car in the order the cars drive past, and sends the list to a police patrol a few kilometres down the road.

From the two lists the patrol can decide without any doubt that certain drivers overtook inside the tunnel, which is strictly forbidden.

Write a program that counts the drivers who can be proven to have overtaken.

Assume the traffic inside the tunnel behaved normally, with no collisions and no cars stopping.

Input

The first line contains the number of cars NN (1N10001 \le N \le 1000).

The next NN lines contain the licence plates in the order the cars entered the tunnel, one plate per line.

The next NN lines contain the licence plates of the same cars in the order they left the tunnel, one plate per line.

A licence plate is 6 to 8 characters long and uses only the uppercase English letters A to Z and the digits 0 to 9. The NN plates are all different.

Output

Print the number of drivers the police can certainly punish for illegal overtaking.