nw = int(input()) W = list(map(int, input().split())) nb = int(input()) B = list(map(int, input().split())) W.sort(reverse = True) B.sort(reverse = True) ans = 0 wp = 0 bp = 0 bef = 1 << 40 while 1: while wp != nw and W[wp] >= bef: wp += 1 if wp == nw: break ans += 1 bef = W[wp] while bp != nb and B[bp] >= bef: bp += 1 if bp == nb: break ans += 1 bef = B[bp] ans2 = 0 wp = 0 bp = 0 bef = 1 << 40 while 1: while bp != nb and B[bp] >= bef: bp += 1 if bp == nb: break ans2 += 1 bef = B[bp] while wp != nw and W[wp] >= bef: wp += 1 if wp == nw: break ans2 += 1 bef = W[wp] print(max(ans, ans2))