def main():
    import sys
    asa =  sys.stdin.readline
    n = int(input())
    s = list(map(int, asa().split()))
    q = int(input())
    t = list(map(int, asa().split()))
    
    c = 0
    s.append(0)
    
    for i in t: # tの中のiを探索
        j = 0
        s[n] = i
        while s[j] != i:
            j += 1
        if j < n:
            c += 1
            
    print(c)
        
    
if __name__ == '__main__':
    main() def main():
    import sys
    asa =  sys.stdin.readline
    n = int(input())
    s = list(map(int, asa().split()))
    q = int(input())
    t = list(map(int, asa().split()))
    
    c = 0
    s.append(0)
    
    for i in t: # tの中のiを探索
        j = 0
        s[n] = i
        while s[j] != i:
            j += 1
        if j < n:
            c += 1
            
    print(c)
        
     main import sys sys asa =  sys.stdin.readline asa sys.stdin.readline sys.stdin sys stdin readline n = int(input()) n int(input()) int input() input s = list(map(int, asa().split())) s list(map(int, asa().split())) list map(int, asa().split()) map int asa().split() ().split () asa split q = int(input()) q int(input()) int input() input t = list(map(int, asa().split())) t list(map(int, asa().split())) list map(int, asa().split()) map int asa().split() ().split () asa split c = 0 c 0 s.append(0) s.append s append 0 for i in t: # tの中のiを探索
        j = 0
        s[n] = i
        while s[j] != i:
            j += 1
        if j < n:
            c += 1
            
     i t j = 0 j 0 s[n] = i s[n] s n i while s[j] != i:
            j += 1
         s[j] != i s[j] s j i j += 1 j 1 if j < n:
            c += 1
            
     j < n j n c += 1 c 1 print(c) print c if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    import sys
    asa =  sys.stdin.readline
    n = int(input())
    s = list(map(int, asa().split()))
    q = int(input())
    t = list(map(int, asa().split()))
    
    c = 0
    s.append(0)
    
    for i in t: # tの中のiを探索
        j = 0
        s[n] = i
        while s[j] != i:
            j += 1
        if j < n:
            c += 1
            
    print(c)
        
     def main():
    import sys
    asa =  sys.stdin.readline
    n = int(input())
    s = list(map(int, asa().split()))
    q = int(input())
    t = list(map(int, asa().split()))
    
    c = 0
    s.append(0)
    
    for i in t: # tの中のiを探索
        j = 0
        s[n] = i
        while s[j] != i:
            j += 1
        if j < n:
            c += 1
            
    print(c)
        
     main
def main():
    import sys
    asa =  sys.stdin.readline
    n = int(input())
    s = list(map(int, asa().split()))
    q = int(input())
    t = list(map(int, asa().split()))
    
    c = 0
    s.append(0)
    
    for i in t: # tの中のiを探索
        j = 0
        s[n] = i
        while s[j] != i:
            j += 1
        if j < n:
            c += 1
            
    print(c)
        
    
if __name__ == '__main__':
    main()
