def main():
    n = int(input())
    S = [int(i) for i in input().split()]
    q = int(input())
    T = [int(i) for i in input().split()]
    print(len(set(S) & set(T)))

main() def main():
    n = int(input())
    S = [int(i) for i in input().split()]
    q = int(input())
    T = [int(i) for i in input().split()]
    print(len(set(S) & set(T))) main n = int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i S = [int(i) for i in input().split()] S [int(i) for i in input().split()] q = int(input()) q int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i T = [int(i) for i in input().split()] T [int(i) for i in input().split()] print(len(set(S) & set(T))) print len(set(S) & set(T)) len set(S) & set(T) set(S) set S set(T) set T main() main def main():
    n = int(input())
    S = [int(i) for i in input().split()]
    q = int(input())
    T = [int(i) for i in input().split()]
    print(len(set(S) & set(T))) def main():
    n = int(input())
    S = [int(i) for i in input().split()]
    q = int(input())
    T = [int(i) for i in input().split()]
    print(len(set(S) & set(T))) main
def main():
    n = int(input())
    S = [int(i) for i in input().split()]
    q = int(input())
    T = [int(i) for i in input().split()]
    print(len(set(S) & set(T)))

main()
