n = int(input())
s = list(map(int, input().split()))
q = int(input())
t = list(map(int, input().split()))

ans = 0
for j in t:
    s.append(j)
    i = 0
    while s[i] != j:
        i += 1
    if i >= n:
        pass
    else:
        ans += 1
print(ans) n = int(input()) n int(input()) int input() input s = list(map(int, input().split())) s list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split q = int(input()) q int(input()) int input() input t = list(map(int, input().split())) t list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 for j in t:
    s.append(j)
    i = 0
    while s[i] != j:
        i += 1
    if i >= n:
        pass
    else:
        ans += 1 j t s.append(j) s.append s append j i = 0 i 0 while s[i] != j:
        i += 1
     s[i] != j s[i] s i j i += 1 i 1 if i >= n:
        pass
    else:
        ans += 1 i >= n i n ans += 1 ans 1 print(ans) print ans ans += 1 1 ans ans = 0 0 ans t = list(map(int, input().split())) list(map(int, input().split())) t i += 1 1 i q = int(input()) int(input()) q s = list(map(int, input().split())) list(map(int, input().split())) s n = int(input()) int(input()) n i = 0 0 i
n = int(input())
s = list(map(int, input().split()))
q = int(input())
t = list(map(int, input().split()))

ans = 0
for j in t:
    s.append(j)
    i = 0
    while s[i] != j:
        i += 1
    if i >= n:
        pass
    else:
        ans += 1
print(ans)