Nw = int(input()) W = list(map(int, input().split())) Nb = int(input()) B = list(map(int, input().split())) Bl = [(W[i], 0) for i in range(Nw)] + [(B[i], 1) for i in range(Nb)] Bl.sort(reverse = True) ans = 0 N = Nw + Nb for bottom in range(2): nexc = bottom minw = 100 h = 0 for i in range(N): w, c = Bl[i] if c == nexc and w < minw: minw = w nexc ^= 1 h += 1 ans = max(ans, h) print(ans)