def solve(): Nw = int(input()) W = [int(i) for i in input().split()] Nb = int(input()) B = [int(i) for i in input().split()] W.sort(reverse=True) B.sort(reverse=True) ans = 1 ans = max(ans, greedy(Nw, Nb, W, B, 0)) ans = max(ans, greedy(Nw, Nb, W, B, 1)) print(ans) def greedy(Nw, Nb, W, B, s): lw, lb = 0, 0 flag = True max_l = 100 tmp = 0 while flag: if s == 0: for i in range(lw, Nw): if W[i] < max_l: max_l = W[i] tmp += 1 lw = i + 1 s ^= 1 break else: flag = False else: for i in range(lb, Nb): if B[i] < max_l: max_l = B[i] tmp += 1 lb = i + 1 s ^= 1 break else: flag = False return tmp if __name__ == '__main__': solve()