def tired(a, b):
    t = abs(a - b)
    if t % 2 == 0:
        r = t // 2
        return r * (r + 1)
    t1, t2 = t // 2, t // 2 + 1
    return t1 * (t1 + 1) // 2 + t2 * (t2 + 1) // 2


A = int(input())
B = int(input())
print(tired(A, B))
