def pyrm_count(first, second): fi = 1 si = 0 pyrm_cur = first[0] cur = True count = 1 while True: tmp = 100 if cur: if si >= len(second): return count while si < len(second): tmp = second[si] si += 1 if pyrm_cur > tmp: pyrm_cur = tmp count += 1 cur = not cur break else: if fi >= len(first): return count while fi < len(first): tmp = first[fi] fi += 1 if pyrm_cur > tmp: pyrm_cur = tmp count += 1 cur = not cur break Nw = int(input()) W = sorted(map(int, input().split(" ")), reverse=True) Nb = int(input()) B = sorted(map(int, input().split(" ")), reverse=True) print(max(pyrm_count(W, B), pyrm_count(B,W)))