def solve(A,pos_a,B,pos_b): ans = 0 tmp = 21 while 1: while A[pos_a] >= tmp: pos_a -= 1 if pos_a < 0: return ans ans += 1 tmp = A[pos_a] while B[pos_b] >= tmp: pos_b -= 1 if pos_b < 0: return ans ans += 1 tmp = B[pos_b] Nw = input() W = map(int,raw_input().split()) Nb = input() B = map(int,raw_input().split()) W.sort() B.sort() print max(solve(W,Nw-1,B,Nb-1),solve(B,Nb-1,W,Nw-1))