a = int(input())
b = int(input())
r = max(a, b)
l = min(a, b)
step = 0
ll = 1
rr = 1
ans = 0
while r != l:
    if step % 2 == 0:
        ans += ll
        ll += 1
        l += 1
    else:
        ans += rr
        rr += 1
        r -= 1
    step += 1
print(ans)