#http://judge.u-aizu.ac.jp/onlinejudge/commentary.jsp?id=ALDS1_4_A
#?????¢??¢?´¢
#???????????§?¨????????????????????????¨?????§??????????????\????????????????????????????????????
def linear_search(list_1, list_2):
    count = 0
    
    for a in list_1:
        i = 0
        list_2.append(a)
        while not a == list_2[i]:
            i += 1
        if not i == len(list_2) - 1:
            count += 1
            
        list_2 = list_2[:-1]
        
    return count

def main():
    n_listA = int(input())
    a = list(set([n for n in input().split()]))
    n_listB = int(input())
    b = list(set([n for n in input().split()]))
    print(linear_search(a,b))

if __name__ == "__main__":
    main() def linear_search(list_1, list_2):
    count = 0
    
    for a in list_1:
        i = 0
        list_2.append(a)
        while not a == list_2[i]:
            i += 1
        if not i == len(list_2) - 1:
            count += 1
            
        list_2 = list_2[:-1]
        
    return count linear_search count = 0 count 0 for a in list_1:
        i = 0
        list_2.append(a)
        while not a == list_2[i]:
            i += 1
        if not i == len(list_2) - 1:
            count += 1
            
        list_2 = list_2[:-1]
        
     a list_1 i = 0 i 0 list_2.append(a) list_2.append list_2 append a while not a == list_2[i]:
            i += 1
         not a == list_2[i] a == list_2[i] a list_2[i] list_2 i i += 1 i 1 if not i == len(list_2) - 1:
            count += 1
            
         not i == len(list_2) - 1 i == len(list_2) - 1 i len(list_2) - 1 len(list_2) len list_2 1 count += 1 count 1 list_2 = list_2[:-1] list_2 list_2[:-1] list_2 :-1 -1 return count count list_1 list_1 list_2 list_2 def main():
    n_listA = int(input())
    a = list(set([n for n in input().split()]))
    n_listB = int(input())
    b = list(set([n for n in input().split()]))
    print(linear_search(a,b)) main n_listA = int(input()) n_listA int(input()) int input() input n for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() n a = list(set([n for n in input().split()])) a list(set([n for n in input().split()])) list set([n for n in input().split()]) set [n for n in input().split()] n_listB = int(input()) n_listB int(input()) int input() input n for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() n b = list(set([n for n in input().split()])) b list(set([n for n in input().split()])) list set([n for n in input().split()]) set [n for n in input().split()] print(linear_search(a,b)) print linear_search(a,b) linear_search a b if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    n_listA = int(input())
    a = list(set([n for n in input().split()]))
    n_listB = int(input())
    b = list(set([n for n in input().split()]))
    print(linear_search(a,b)) def main():
    n_listA = int(input())
    a = list(set([n for n in input().split()]))
    n_listB = int(input())
    b = list(set([n for n in input().split()]))
    print(linear_search(a,b)) main def linear_search(list_1, list_2):
    count = 0
    
    for a in list_1:
        i = 0
        list_2.append(a)
        while not a == list_2[i]:
            i += 1
        if not i == len(list_2) - 1:
            count += 1
            
        list_2 = list_2[:-1]
        
    return count def linear_search(list_1, list_2):
    count = 0
    
    for a in list_1:
        i = 0
        list_2.append(a)
        while not a == list_2[i]:
            i += 1
        if not i == len(list_2) - 1:
            count += 1
            
        list_2 = list_2[:-1]
        
    return count linear_search
#http://judge.u-aizu.ac.jp/onlinejudge/commentary.jsp?id=ALDS1_4_A
#?????¢??¢?´¢
#???????????§?¨????????????????????????¨?????§??????????????\????????????????????????????????????
def linear_search(list_1, list_2):
    count = 0
    
    for a in list_1:
        i = 0
        list_2.append(a)
        while not a == list_2[i]:
            i += 1
        if not i == len(list_2) - 1:
            count += 1
            
        list_2 = list_2[:-1]
        
    return count

def main():
    n_listA = int(input())
    a = list(set([n for n in input().split()]))
    n_listB = int(input())
    b = list(set([n for n in input().split()]))
    print(linear_search(a,b))

if __name__ == "__main__":
    main()