a=int(input())
b=int(input())

x=abs(a-b)
temp=0
if x==1 :
    print(1)
elif x==2 :
    print(2)
else :
    if x%2==0 :
        for i in range(1,x//2+1) :
            temp+=i
        print(temp*2)
    else :
        for i in range(1,x//2+1) :
            temp+=i
        print(temp*2+i+1)