n = int(input())
S =input().split(" ")
l =int(input())
T = input().split(" ")
ans =0
for t in T:
    S.append(t)
    j =0
    while S[j] !=t:
        j+=1
    if j !=n:
        ans +=1
    S=S[:-1]
print(ans) n = int(input()) n int(input()) int input() input S =input().split(" ") S input().split(" ") ().split () input split " " l =int(input()) l int(input()) int input() input T = input().split(" ") T input().split(" ") ().split () input split " " ans =0 ans 0 for t in T:
    S.append(t)
    j =0
    while S[j] !=t:
        j+=1
    if j !=n:
        ans +=1
    S=S[:-1] t T S.append(t) S.append S append t j =0 j 0 while S[j] !=t:
        j+=1
     S[j] !=t S[j] S j t j+=1 j 1 if j !=n:
        ans +=1
     j !=n j n ans +=1 ans 1 S=S[:-1] S S[:-1] S :-1 -1 print(ans) print ans j =0 0 j j+=1 1 j ans =0 0 ans l =int(input()) int(input()) l T = input().split(" ") input().split(" ") T S=S[:-1] S[:-1] S S =input().split(" ") input().split(" ") S n = int(input()) int(input()) n ans +=1 1 ans
n = int(input())
S =input().split(" ")
l =int(input())
T = input().split(" ")
ans =0
for t in T:
    S.append(t)
    j =0
    while S[j] !=t:
        j+=1
    if j !=n:
        ans +=1
    S=S[:-1]
print(ans)
