nw = int(input()) w = sorted(list(map(int, input().split())), reverse=True) nb = int(input()) b = sorted(list(map(int, input().split())), reverse=True) blocks = [] for x in w: blocks.append((x, 0)) for x in b: blocks.append((x, 1)) blocks.sort(reverse=True) cnt = 1 top = blocks[0][0] color = blocks[0][1] i = 1 while i < nw + nb: x, c = blocks[i] if x < top and c != color: top = x color ^= 1 cnt += 1 i += 1 ans = cnt color = blocks[0][1] i = 0 while i < nw + nb: _, c = blocks[i] if c != color: color ^= 1 break i += 1 top = blocks[i][0] cnt = 1 while i < nw + nb: x, c = blocks[i] if x < top and c != color: top = x color ^= 1 cnt += 1 i += 1 ans = max(ans, cnt) print(ans)