a = int(input())
b = int(input())
a, b = min(a, b), max(a, b)
sum1 = 0
sum2 = 0
if (b - a) % 2 == 0: 
    st1 = int((b - a)*0.5) + 1
    st2 = int((b - a)*0.5) + 1
else:
    st1 = int((b - a)*0.5 + 1.5)
    st2 = int((b - a)*0.5 + 0.5)
for i in range(1, st1): sum1 += i
for i in range(1, st2): sum2 += i
print(sum1 + sum2)