# No.110 しましまピラミッド def make_pyramid(A, B): cur, ret = float("inf"), 0 memo_a, memo_b = 0, 0 for _ in range(max(len(A), len(B))): for i, a in enumerate(A[memo_a:], memo_a): if a < cur: cur, memo_a = a, i ret += 1 break else: break for i, b in enumerate(B[memo_b:], memo_b): if b < cur: cur, memo_b = b, i ret += 1 break else: break return ret def main(): _ = input() W = sorted(map(int, input().split()), reverse=1) _ = input() B = sorted(map(int, input().split()), reverse=1) ans = max(make_pyramid(W, B), make_pyramid(B, W)) print(ans) if __name__ == "__main__": main()