n = int(eval(input()))

s = input().split()

q = int(eval(input()))

t = input().split()

cont = 0

for i in t:

    for o in s:

        if i == o:

            cont +=1

            break



print(cont)
n = int(eval(input()))

s = set(input().split())

q = int(eval(input()))

t = set(input().split())



print((len(s & t)))
n = int(eval(input()))
s = input().split()
q = int(eval(input()))
t = input().split()
cont = 0
for i in t:
    for o in s:
        if i == o:
            cont += 1
            break
print(cont)

n = int(eval(input()))
s = set(input().split())
q = int(eval(input()))
t = set(input().split())
print((len(s & t)))

-s = input().split() +s = set(input().split()) -t = input().split() -cont = 0 -for i in t: -    for o in s: -        if i == o: -            cont += 1 -            break -print(cont) +t = set(input().split()) +print((len(s & t)))