# coding: utf-8 #yuki_110 def solve(l1,l2): res=0 i=21 F=False while i>0: if l1[i] and not F: res+=1 F=True elif l2[i] and F: res+=1 F=False i-=1 return res nw=int(raw_input()) lmw=list(map(int, raw_input().split())) nb=int(raw_input()) lmb=list(map(int, raw_input().split())) w=list(set(lmw)) b=list(set(lmb)) lw=[0 for i in xrange(22)] lb=[0 for i in xrange(22)] for i in xrange(len(w)): lw[w[i]]=1 for i in xrange(len(b)): lb[b[i]]=1 res=max(solve(lw,lb),solve(lb,lw)) print res