def binarySearch():

    n = int(eval(input()))

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

    q = int(eval(input()))

    T = set(map(int, 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.intersection(T))))

    



binarySearch()
def binarySearch():
    n = int(eval(input()))
    S = set(map(int, input().split()))
    q = int(eval(input()))
    T = set(map(int, 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.intersection(T))))


binarySearch()

-    S = set(map(int, input().split())) +    S = set(input().split()) -    T = set(map(int, input().split())) +    T = set(input().split())