a=int(input())
b=int(input())
if abs(a-b)%2==0:
    tengah=int((a+b)/2)
else:
    tengah=int((a+b+1)/2)
a1=abs(a-tengah)
b1=abs(b-tengah)
i=1
j=0
tiredness=0
while j<a1:
    tiredness+=i
    i+=1
    j+=1
j=0
i=1
while j<b1:
    tiredness+=i
    i+=1
    j+=1
print(tiredness)
