a = int(raw_input())
b = int(raw_input())
mid = (a+b)/2

if a > b:
    a, b = b, a

ans = 0
sum = 0
step = 0
while a < mid:
    a += 1
    step += 1
    sum += step 

step = 0

while mid < b:
    b -= 1
    step += 1
    sum += step

print sum