def binarySearch():

    n = int(eval(input()))

    S = set(input().split())

    q = int(eval(input()))

    T = set(input().split())

    print((len(S.intersection(T))))

    



binarySearch()
def binarySearch():

    n = int(eval(input()))

    S = set(input().split())

    q = int(eval(input()))

    T = set(input().split())

    print((len(S & T)))

    



binarySearch()
def binarySearch():
    n = int(eval(input()))
    S = set(input().split())
    q = int(eval(input()))
    T = set(input().split())
    print((len(S.intersection(T))))


binarySearch()

def binarySearch():
    n = int(eval(input()))
    S = set(input().split())
    q = int(eval(input()))
    T = set(input().split())
    print((len(S & T)))


binarySearch()

-    print((len(S.intersection(T)))) +    print((len(S & T)))