nw = input() w = map(int, raw_input().split()) nb = input() b = map(int, raw_input().split()) w.sort(reverse = True) b.sort(reverse = True) def solve(nw, w, nb, b): i = 0 j = 0 res = 0 under = float('inf') updated = True k = 0 while updated: updated = False if k % 2 == 0: while i < nw and w[i] >= under: i += 1 if i < nw: under = w[i] res += 1 updated = True else: while j < nb and b[j] >= under: j += 1 if j < nb: under = b[j] res += 1 updated = True k += 1 return res ans = max(solve(nw, w, nb, b), solve(nb, b, nw, w)) print ans