def linearSearch(n, S, q, T):
    count = 0
    if n <= q:
        for i in S:
            if i in T:
                count += 1
        print(count)
                
    else:
        for k in T:
            if k in S:
                count += 1
        print(count)
                
    

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

linearSearch(n, S, q, T) def linearSearch(n, S, q, T):
    count = 0
    if n <= q:
        for i in S:
            if i in T:
                count += 1
        print(count)
                
    else:
        for k in T:
            if k in S:
                count += 1
        print(count)
                
     linearSearch count = 0 count 0 if n <= q:
        for i in S:
            if i in T:
                count += 1
        print(count)
                
    else:
        for k in T:
            if k in S:
                count += 1
        print(count)
                
     n <= q n q for i in S:
            if i in T:
                count += 1
         i S if i in T:
                count += 1
         i in T i T count += 1 count 1 print(count) print count for k in T:
            if k in S:
                count += 1
         k T if k in S:
                count += 1
         k in S k S count += 1 count 1 print(count) print count n n S S q q T T 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 linearSearch(n, S, q, T) linearSearch n S q T T = list(map(int, input().split())) list(map(int, input().split())) T S = list(map(int, input().split())) list(map(int, input().split())) S q = int(input()) int(input()) q n = int(input()) int(input()) n def linearSearch(n, S, q, T):
    count = 0
    if n <= q:
        for i in S:
            if i in T:
                count += 1
        print(count)
                
    else:
        for k in T:
            if k in S:
                count += 1
        print(count)
                
     def linearSearch(n, S, q, T):
    count = 0
    if n <= q:
        for i in S:
            if i in T:
                count += 1
        print(count)
                
    else:
        for k in T:
            if k in S:
                count += 1
        print(count)
                
     linearSearch
def linearSearch(n, S, q, T):
    count = 0
    if n <= q:
        for i in S:
            if i in T:
                count += 1
        print(count)
                
    else:
        for k in T:
            if k in S:
                count += 1
        print(count)
                
    

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

linearSearch(n, S, q, T)