a=int(input())
b=int(input())
c=abs(a-b)
if c==1:
    print(1)
elif c%2==0:
    d=c//2
    d=(d*(d+1))//2
    print(d*2)
else:
    d=c//2
    e=(c//2)+1
    d=(d*(d+1))//2
    e=(e*(e+1))//2
    print(d+e)