a=int(input())
b=int(input())
diff=abs(a-b)-1
if diff%2==1:
    d_a=(diff//2)+1
    d_b=d_a
    ans=d_a*(d_a+1)
else:
    d_a=diff//2
    d_b=d_a+1
    ans=((d_a*(d_a+1))//2)+((d_b*(d_b+1))//2)
print(ans)