a=int(input())
b=int(input())
d=abs(a-b)
t=0
c=1
if d%2==0:
    m=d//2
    while m>0:
        t+=c
        c+=1
        m-=1
    print(2*t)
else:
    m=d//2
    while m>0:
        t+=c
        c+=1
        m-=1
    print(2*t+c)