n = eval(input())

s = input().split()

q = eval(input())

t = input().split()



ans = 0

for c1 in t:

    for c2 in s:

        if c1 == c2:

            ans += 1

            break



print(ans)
def linear_search(l, key):

    _l = l + [key]



    i = 0

    while key != _l[i]:

        i += 1



    if i == len(_l) - 1:

        return -1



    return i





if __name__ == '__main__':

    n = eval(input())

    s = input().split()

    q = eval(input())

    t = input().split()



    ans = 0

    for c1 in t:

        if linear_search(s, c1) >= 0:

            ans += 1



    print(ans)
n = eval(input())
s = input().split()
q = eval(input())
t = input().split()
ans = 0
for c1 in t:
    for c2 in s:
        if c1 == c2:
            ans += 1
            break
print(ans)

def linear_search(l, key):
    _l = l + [key]
    i = 0
    while key != _l[i]:
        i += 1
    if i == len(_l) - 1:
        return -1
    return i


if __name__ == "__main__":
    n = eval(input())
    s = input().split()
    q = eval(input())
    t = input().split()
    ans = 0
    for c1 in t:
        if linear_search(s, c1) >= 0:
            ans += 1
    print(ans)

-n = eval(input()) -s = input().split() -q = eval(input()) -t = input().split() -ans = 0 -for c1 in t: -    for c2 in s: -        if c1 == c2: +def linear_search(l, key): +    _l = l + [key] +    i = 0 +    while key != _l[i]: +        i += 1 +    if i == len(_l) - 1: +        return -1 +    return i + + +if __name__ == "__main__": +    n = eval(input()) +    s = input().split() +    q = eval(input()) +    t = input().split() +    ans = 0 +    for c1 in t: +        if linear_search(s, c1) >= 0: -            break -print(ans) +    print(ans)