def main():
    n = int(input())
    S = list(map(int, input().split()))
    
    q = int(input())
    T = list(map(int, input().split()))
    
    res = 0
    for i in T:
        if i in S:
            res += 1
    print(res)
    

if __name__ == '__main__':
    main()
     def main():
    n = int(input())
    S = list(map(int, input().split()))
    
    q = int(input())
    T = list(map(int, input().split()))
    
    res = 0
    for i in T:
        if i in S:
            res += 1
    print(res)
     main n = int(input()) n int(input()) int input() input S = list(map(int, input().split())) S list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split q = int(input()) q int(input()) int input() input T = list(map(int, input().split())) T list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split res = 0 res 0 for i in T:
        if i in S:
            res += 1
     i T if i in S:
            res += 1
     i in S i S res += 1 res 1 print(res) print res if __name__ == '__main__':
    main()
     __name__ == '__main__' __name__ '__main__' main() main def main():
    n = int(input())
    S = list(map(int, input().split()))
    
    q = int(input())
    T = list(map(int, input().split()))
    
    res = 0
    for i in T:
        if i in S:
            res += 1
    print(res)
     def main():
    n = int(input())
    S = list(map(int, input().split()))
    
    q = int(input())
    T = list(map(int, input().split()))
    
    res = 0
    for i in T:
        if i in S:
            res += 1
    print(res)
     main
def main():
    n = int(input())
    S = list(map(int, input().split()))
    
    q = int(input())
    T = list(map(int, input().split()))
    
    res = 0
    for i in T:
        if i in S:
            res += 1
    print(res)
    

if __name__ == '__main__':
    main()
    
