i=input i() W=set(map(int,i().split())) i() B=set(map(int,i().split())) w,b=1,1 c=0 for x in sorted(list(W|B)): if x in W and x in B: c+=1; w,b=b,w 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)