f1 = int(input())
f2 = int(input())

middle = (f1 + f2) // 2

t = 1
total = 0
for i in range(abs(f1-middle)):
    total += t
    t += 1
t = 1
for i in range(abs(f2-middle)):
    total += t
    t += 1

print(total)