import bisect

n = int(eval(input()))

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

eval(input())

k = 0

for e in map(int, input().split()):

    i = bisect.bisect_left(A, e)

    if i < n and A[i] == e: k += 1 

print(k)

def m():

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

 eval(input());print((len(s&set(input().split()))))

if'__main__'==__name__:m()

import bisect

n = int(eval(input()))
A = list(map(int, input().split()))
eval(input())
k = 0
for e in map(int, input().split()):
    i = bisect.bisect_left(A, e)
    if i < n and A[i] == e:
        k += 1
print(k)

def m():
    eval(input())
    s = set(input().split())
    eval(input())
    print((len(s & set(input().split()))))


if "__main__" == __name__:
    m()

-import bisect +def m(): +    eval(input()) +    s = set(input().split()) +    eval(input()) +    print((len(s & set(input().split())))) -n = int(eval(input())) -A = list(map(int, input().split())) -eval(input()) -k = 0 -for e in map(int, input().split()): -    i = bisect.bisect_left(A, e) -    if i < n and A[i] == e: -        k += 1 -print(k) + +if "__main__" == __name__: +    m()