a = int(input())
b = int(input())
c = abs(a-b)
sum1 = 0
sum2 = 0
a1 = 1
a2 = 1
for i in range(c):
    if i < c//2:
        sum1+=a1
        a1+=1
    else:
        sum2 += a2
        a2 +=1
print(sum1+sum2)