ns = int(input())
s = list(map(int, input().split()))

nt = int(input())
t = list(map(int, input().split()))

count = 0

for i in t:
    # 配列に番兵を追加
    s += [i]
    j = 0
    while s[j] != i:
        j += 1
    s.pop()
    if j == ns:
        continue
    count += 1

print(count)
 ns = int(input()) ns 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 nt = int(input()) nt 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 count = 0 count 0 for i in t:
    # 配列に番兵を追加
    s += [i]
    j = 0
    while s[j] != i:
        j += 1
    s.pop()
    if j == ns:
        continue
    count += 1 i t s += [i] s [i] i j = 0 j 0 while s[j] != i:
        j += 1
     s[j] != i s[j] s j i j += 1 j 1 s.pop() s.pop s pop if j == ns:
        continue
     j == ns j ns continue count += 1 count 1 print(count) print count ns = int(input()) int(input()) ns j = 0 0 j s = list(map(int, input().split())) list(map(int, input().split())) s j += 1 1 j t = list(map(int, input().split())) list(map(int, input().split())) t count = 0 0 count nt = int(input()) int(input()) nt count += 1 1 count s += [i] [i] s
ns = int(input())
s = list(map(int, input().split()))

nt = int(input())
t = list(map(int, input().split()))

count = 0

for i in t:
    # 配列に番兵を追加
    s += [i]
    j = 0
    while s[j] != i:
        j += 1
    s.pop()
    if j == ns:
        continue
    count += 1

print(count)

