
def main():
    n = int(input())
    S = [int(i) for i in input().split()]
    q = int(input())
    T = [int(i) for i in input().split()]
    
    count = 0
    for t in T:
        for s in S:
            if t == s:
                count += 1
                break

    print(count)

if __name__ == '__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()]
    
    count = 0
    for t in T:
        for s in S:
            if t == s:
                count += 1
                break

    print(count) 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()] count = 0 count 0 for t in T:
        for s in S:
            if t == s:
                count += 1
                break

     t T for s in S:
            if t == s:
                count += 1
                break

     s S if t == s:
                count += 1
                break

     t == s t s count += 1 count 1 break print(count) print count if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' 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()]
    
    count = 0
    for t in T:
        for s in S:
            if t == s:
                count += 1
                break

    print(count) def main():
    n = int(input())
    S = [int(i) for i in input().split()]
    q = int(input())
    T = [int(i) for i in input().split()]
    
    count = 0
    for t in T:
        for s in S:
            if t == s:
                count += 1
                break

    print(count) 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()]
    
    count = 0
    for t in T:
        for s in S:
            if t == s:
                count += 1
                break

    print(count)

if __name__ == '__main__':
    main()