#coding:UTF-8
def LS(n,S,q,T):
    count=0
    if n>q:
        for i in range(q):
            if T[i] in S:
                count+=1
    else:
        for i in range(n):
            if S[i] in T:
                count+=1
    print(count)
  
if __name__=="__main__":
    n=int(input())
    S=input().split(" ")
    q=int(input())
    T=input().split(" ")
    LS(n,S,q,T) def LS(n,S,q,T):
    count=0
    if n>q:
        for i in range(q):
            if T[i] in S:
                count+=1
    else:
        for i in range(n):
            if S[i] in T:
                count+=1
    print(count)
   LS count=0 count 0 if n>q:
        for i in range(q):
            if T[i] in S:
                count+=1
    else:
        for i in range(n):
            if S[i] in T:
                count+=1
     n>q n q for i in range(q):
            if T[i] in S:
                count+=1
     i range(q) range q if T[i] in S:
                count+=1
     T[i] in S T[i] T i S count+=1 count 1 for i in range(n):
            if S[i] in T:
                count+=1
     i range(n) range n if S[i] in T:
                count+=1
     S[i] in T S[i] S i T count+=1 count 1 print(count) print count n n S S q q T T if __name__=="__main__":
    n=int(input())
    S=input().split(" ")
    q=int(input())
    T=input().split(" ")
    LS(n,S,q,T) __name__=="__main__" __name__ "__main__" n=int(input()) n int(input()) int input() input S=input().split(" ") S input().split(" ") ().split () input split " " q=int(input()) q int(input()) int input() input T=input().split(" ") T input().split(" ") ().split () input split " " LS(n,S,q,T) LS n S q T T=input().split(" ") input().split(" ") T q=int(input()) int(input()) q n=int(input()) int(input()) n S=input().split(" ") input().split(" ") S def LS(n,S,q,T):
    count=0
    if n>q:
        for i in range(q):
            if T[i] in S:
                count+=1
    else:
        for i in range(n):
            if S[i] in T:
                count+=1
    print(count)
   def LS(n,S,q,T):
    count=0
    if n>q:
        for i in range(q):
            if T[i] in S:
                count+=1
    else:
        for i in range(n):
            if S[i] in T:
                count+=1
    print(count)
   LS
#coding:UTF-8
def LS(n,S,q,T):
    count=0
    if n>q:
        for i in range(q):
            if T[i] in S:
                count+=1
    else:
        for i in range(n):
            if S[i] in T:
                count+=1
    print(count)
  
if __name__=="__main__":
    n=int(input())
    S=input().split(" ")
    q=int(input())
    T=input().split(" ")
    LS(n,S,q,T)