#coding:utf-8

#1_4_A

def isFound(array, x):

    """ linear search """

    array.append(x)

    i = 0

    while array[i] != x:

        i += 1

    if i == len(array)-1:

        return False

    return True



n = int(eval(input()))

S = list(map(int, input().split()))

q = int(eval(input()))

T = list(map(int, input().split()))

count = 0



for i in range(q):

    if isFound(S, T[i]):

        count += 1



print(count)
#coding:utf-8

#1_4_A

n = int(eval(input()))

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

q = int(eval(input()))

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



print((len(S & T)))
# coding:utf-8
# 1_4_A
def isFound(array, x):
    """linear search"""
    array.append(x)
    i = 0
    while array[i] != x:
        i += 1
    if i == len(array) - 1:
        return False
    return True


n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
count = 0
for i in range(q):
    if isFound(S, T[i]):
        count += 1
print(count)

# coding:utf-8
# 1_4_A
n = int(eval(input()))
S = set(map(int, input().split()))
q = int(eval(input()))
T = set(map(int, input().split()))
print((len(S & T)))

-def isFound(array, x): -    """linear search""" -    array.append(x) -    i = 0 -    while array[i] != x: -        i += 1 -    if i == len(array) - 1: -        return False -    return True - - -S = list(map(int, input().split())) +S = set(map(int, input().split())) -T = list(map(int, input().split())) -count = 0 -for i in range(q): -    if isFound(S, T[i]): -        count += 1 -print(count) +T = set(map(int, input().split())) +print((len(S & T)))