def main():
    n = int(input())
    s = list(map(int, input().split())) 
    q = int(input())
    t = list(map(int, input().split()))
    
    # 集合的なら
    # res = len(set(s) & set(p))
    # print(res)
    # 線形探索なら
    cnt = 0
    for i in t:
        if i in s:
            cnt += 1
    print(cnt)
    
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 = len(set(s) & set(p))
    # print(res)
    # 線形探索なら
    cnt = 0
    for i in t:
        if i in s:
            cnt += 1
    print(cnt)
     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 cnt = 0 cnt 0 for i in t:
        if i in s:
            cnt += 1
     i t if i in s:
            cnt += 1
     i in s i s cnt += 1 cnt 1 print(cnt) print cnt 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 = len(set(s) & set(p))
    # print(res)
    # 線形探索なら
    cnt = 0
    for i in t:
        if i in s:
            cnt += 1
    print(cnt)
     def main():
    n = int(input())
    s = list(map(int, input().split())) 
    q = int(input())
    t = list(map(int, input().split()))
    
    # 集合的なら
    # res = len(set(s) & set(p))
    # print(res)
    # 線形探索なら
    cnt = 0
    for i in t:
        if i in s:
            cnt += 1
    print(cnt)
     main
def main():
    n = int(input())
    s = list(map(int, input().split())) 
    q = int(input())
    t = list(map(int, input().split()))
    
    # 集合的なら
    # res = len(set(s) & set(p))
    # print(res)
    # 線形探索なら
    cnt = 0
    for i in t:
        if i in s:
            cnt += 1
    print(cnt)
    
if __name__ == '__main__':
    main()
