Nw = int(input()) W = sorted(list(map(int, input().split())), reverse=True) Nb = int(input()) B = sorted(list(map(int, input().split())), reverse=True) def solve(P, Q): i, j = 1, 0 x = P[0] ct = 1 while True: while j < len(Q) and Q[j] >= x: j += 1 if j == len(Q): return ct x = Q[j] ct += 1 while i < len(P) and P[i] >= x: i += 1 if i == len(P): return ct x = P[i] ct += 1 print(max(solve(W, B), solve(B, W)))