def f(y, z): x = 0 for i in range(1, len(l)): if l[i][0] < y and l[i][1] != z: x += 1 y = l[i][0] z = l[i][1] return x input() w = sorted([[int(i), 'w'] for i in input().split()]) input() b = sorted([[int(i), 'b'] for i in input().split()]) l = sorted(w + b)[::-1] if w[-1][0] != b[-1][0]: y = l[0][0] z = l[0][1] x = f(y, z) else: y = w[-1][0] z = 'w' x1 = f(y, z) y = b[-1][0] z = 'b' x2 = f(y, z) x = max(x1, x2) print(x+1)