import bisect def get_smaller_largest(l, n): for i in range(len(l) - 1, -1, -1): if l[i] < n: return l[i] return None def calc_height(pWl, pBl, pColor): now_color = pColor now_len = 999 now_height = 0 while True: if now_color == 0: #次に白ブロックを積む smaller = get_smaller_largest(pWl, now_len) if smaller is None: break elif now_color == 1: #次に黒ブロックを積む smaller = get_smaller_largest(pBl, now_len) if smaller is None: break now_color = (now_color + 1) % 2 now_len = smaller now_height += 1 return now_height Nw = int(input()) Wl = sorted(map(int, input().split())) Nb = int(input()) Bl = sorted(map(int, input().split())) Wl2 = Wl[:] Bl2 = Bl[:] print(max(calc_height(Wl, Bl, 0), calc_height(Wl2, Bl2, 1)))