a=int(input())
b=int(input())
t=0
x=(a+b)//2
if b>a:
    for i in range(1,x+1-a):
        t=t+i
    for j in range(1,b-x+1):
        t=t+j
    print(t)
else:
    for i in range(1,x+1-b):
        t=t+i
    for j in range(1,a-x+1):
        t=t+j
    print(t)