w=int(input()) W=set(map(int,input().split())) b=int(input()) B=set(map(int,input().split())) w,b=1,1 c=0 for x in W|B: if x in W and x in B: c+=1 elif x in W and b: c+=1; w,b=1,0 elif x in B and w: c+=1; w,b=0,1 print(c)