n = int(eval(input()))

S = [int(x) for x in input().split()]

q = int(eval(input()))

T = [int(x) for x in input().split()]



res = 0



for key in T:

    left = 0

    right = n

    while left < right:

        mid = (left + right) // 2

        if S[mid] == key:

            res += 1

            right = -1

        elif key < S[mid]:

            right = mid

        else:

            left = mid + 1



print(res)
len_a = eval(input())

a = set(map(int, input().split()))

len_b = eval(input())

b = set(map(int, input().split()))



print((len(a & b)))

n = int(eval(input()))
S = [int(x) for x in input().split()]
q = int(eval(input()))
T = [int(x) for x in input().split()]
res = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (left + right) // 2
        if S[mid] == key:
            res += 1
            right = -1
        elif key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(res)

len_a = eval(input())
a = set(map(int, input().split()))
len_b = eval(input())
b = set(map(int, input().split()))
print((len(a & b)))

-n = int(eval(input())) -S = [int(x) for x in input().split()] -q = int(eval(input())) -T = [int(x) for x in input().split()] -res = 0 -for key in T: -    left = 0 -    right = n -    while left < right: -        mid = (left + right) // 2 -        if S[mid] == key: -            res += 1 -            right = -1 -        elif key < S[mid]: -            right = mid -        else: -            left = mid + 1 -print(res) +len_a = eval(input()) +a = set(map(int, input().split())) +len_b = eval(input()) +b = set(map(int, input().split())) +print((len(a & b)))