nw = int(input()) brick = [(int(x), True) for x in input().split()] nb = int(input()) brick += [(int(x), False) for x in input().split()] res = 0 brick.sort(key=lambda b: b[0], reverse=True) for st in brick[:2]: prev = st cnt = 1 for b in brick: if b[0] < prev[0] and b[1] != prev[1]: prev = b cnt += 1 res = max(cnt, res) print(res)