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