Bajtazar's confectionery has received two urgent cake orders. As is well known, cakes have layers. The confectionery offers $n$ different types of layers, and each cake produced contains exactly one layer of each type. A cake order specifies the order in which the layers must be stacked.
Bajtazar employs $n$ pastry chefs; the $i$-th chef (for $1 \le i \le n$) can prepare a layer of type $i$. A chef takes one minute to prepare their layer (and can only work on one cake at a time during this period). Layers for each cake must be stacked one after another. Work on the cakes can proceed in parallel. What is the minimum time required to produce the two ordered cakes?
Input
The first line of input contains a single integer $n$ ($1 \le n \le 1\,000\,000$). The second and third lines contain descriptions of the first and second orders, respectively. Each of these descriptions is a sequence of $n$ distinct integers from $1$ to $n$, specifying the types of successive layers of the given cake, starting from the layer placed at the top of the cake.
Output
The first and only line of output should contain a single integer - the minimum number of minutes required to produce the ordered cakes.
Examples
Input 1
3 1 2 3 3 2 1
Output 1
4