
def two_sum(t, xs_list, xs_set):
    for x in xs:
        y = t - x
        if x != y and y in xs_set:
            return True
    return False


if __name__ == "__main__":
    with open("../data/c2a4.txt") as f:
        xs = list(map(int, f.readlines()))

    xs_min = [x for x in xs if x < 0]
    xs_max_set = set([x for x in xs if x > 0])

    limit = 10000
    two_sums = 0
    for t in range(-limit, limit + 1):
        if t % 10 == 0:
            print(t)
        if two_sum(t, xs_min, xs_max_set):
            two_sums += 1

    print(two_sums)
