# ALDS1_4_A.
# リニアサーチ。

def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    n = int(input())
    S = intinput()
    q = int(input())
    T = intinput()
    count = 0
    for k in T:
        if k in S: count += 1
    print(count)

    
if __name__ == "__main__":
    main() def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a intinput a = input().split() a input().split() ().split () input split for i in range(len(a)):
        a[i] = int(a[i])
     i range(len(a)) range len(a) len a a[i] = int(a[i]) a[i] a i int(a[i]) int a[i] a i return a a def main():
    n = int(input())
    S = intinput()
    q = int(input())
    T = intinput()
    count = 0
    for k in T:
        if k in S: count += 1
    print(count)

     main n = int(input()) n int(input()) int input() input S = intinput() S intinput() intinput q = int(input()) q int(input()) int input() input T = intinput() T intinput() intinput count = 0 count 0 for k in T:
        if k in S: count += 1
     k T if k in S: count += 1
     k in S k S print(count) print count if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a intinput def main():
    n = int(input())
    S = intinput()
    q = int(input())
    T = intinput()
    count = 0
    for k in T:
        if k in S: count += 1
    print(count)

     def main():
    n = int(input())
    S = intinput()
    q = int(input())
    T = intinput()
    count = 0
    for k in T:
        if k in S: count += 1
    print(count)

     main
# ALDS1_4_A.
# リニアサーチ。

def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    n = int(input())
    S = intinput()
    q = int(input())
    T = intinput()
    count = 0
    for k in T:
        if k in S: count += 1
    print(count)

    
if __name__ == "__main__":
    main()
