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

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

        t=1
        for i in range(max(a,b), res, -1):
            count+=t
            t+=1
        print(count)