def s(n):
    sum = 0
    for i in range(1, n + 1):
        sum += i
    return sum

a = int(input())
b = int(input())
a, b = min(a, b), max(a, b)
step = b - a
if step % 2 == 0:
    print(s(step // 2) * 2)
else:
    print(s(step // 2) * 2 + (step + 1) // 2)