from bisect import * Nw = int(input()) W = list(map(int, input().split())) Nb = int(input()) B = list(map(int, input().split())) W.sort() B.sort() ans = 0 cur = W[-1] c = 1 while True: if c%2==1: idx = bisect_left(B, cur) else: idx = bisect_left(W, cur) if idx==0: ans = max(ans, c) break else: if c%2==1: cur = B[idx-1] else: cur = W[idx-1] c += 1 cur = B[-1] c = 1 while True: if c%2==1: idx = bisect_left(W, cur) else: idx = bisect_left(B, cur) if idx==0: ans = max(ans, c) break else: if c%2==1: cur = W[idx-1] else: cur = B[idx-1] c += 1 print(ans)