import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines readline() W = sorted(map(int,readline().split())) readline() B = sorted(map(int,readline().split())) def F(W,B): W = W[:] B = B[:] x = W.pop() n = 1 while True: while B and B[-1] >= x: B.pop() if not B: return n x = B[-1] n += 1 W,B = B,W answer = max(F(B,W), F(W,B)) print(answer)