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

def fact(a):
    ans=0
    for i in range(a,0,-1):
        ans=ans+i
    return ans
d=abs(a-b)
if d==1:
    print("1")
elif d%2==0:
    a=fact(d//2)
    a=a*2
    print(a)
else:
    a=fact(d//2)
    b=fact((d+1)//2)
    print(a+b)
