import math
n=int(input())
m=int(input())
if(n==m):
    print(0)
elif(n+1==m):
    print(1)
else:
    d=abs(m-n)
    if(d%2==0):
        e=d//2
        sum=0
        for i in range(1,e+1):
            sum=sum+i
        print(sum*2)
    elif(d%2!=0):
        e=d//2
        f=e+1
        sum=0
        for i in range(1,f+1):
            sum=sum+i
        print(sum+(sum-f))
        
    