def ALDS1_4A():
    n, S = int(input()), set(map(int, input().split()))
    q, T = int(input()), set(map(int, input().split()))
    print(len(S.intersection(T)))
if __name__ == '__main__':
    ALDS1_4A() def ALDS1_4A():
    n, S = int(input()), set(map(int, input().split()))
    q, T = int(input()), set(map(int, input().split()))
    print(len(S.intersection(T))) ALDS1_4A n, S = int(input()), set(map(int, input().split())) n int(input()) int input() input S set(map(int, input().split())) set map(int, input().split()) map int input().split() ().split () input split q, T = int(input()), set(map(int, input().split())) q int(input()) int input() input T set(map(int, input().split())) set map(int, input().split()) map int input().split() ().split () input split print(len(S.intersection(T))) print len(S.intersection(T)) len S.intersection(T) S.intersection S intersection T if __name__ == '__main__':
    ALDS1_4A() __name__ == '__main__' __name__ '__main__' ALDS1_4A() ALDS1_4A def ALDS1_4A():
    n, S = int(input()), set(map(int, input().split()))
    q, T = int(input()), set(map(int, input().split()))
    print(len(S.intersection(T))) def ALDS1_4A():
    n, S = int(input()), set(map(int, input().split()))
    q, T = int(input()), set(map(int, input().split()))
    print(len(S.intersection(T))) ALDS1_4A
def ALDS1_4A():
    n, S = int(input()), set(map(int, input().split()))
    q, T = int(input()), set(map(int, input().split()))
    print(len(S.intersection(T)))
if __name__ == '__main__':
    ALDS1_4A()