x=int(input())
y=int(input())
if(abs(x-y) == 1):
    print("1")
elif(abs(x-y)==2):
    print("2")
else:
    d = abs(x-y)
    if d%2 ==0:
        a=d//2
        print(a*(a+1)//2 * 2)
    else:
        a=d//2 + 1
        print(a*(a+1)//2 + ((a-1)*(a))//2)