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

if(abs(a-b)<=2):
    print(abs(a-b))
else:
    dis = abs(a-b)
    if(dis%2==0):
        dis = dis//2
        ans = (dis*(dis+1))//2
        print(2*ans)
    else:
        dis = dis//2
        ans = (dis*(dis+1))//2
        dis+=1
        ans+= ((dis*(dis+1))//2)
        print(ans)