a = int(input())
b = int(input())
if b < a:
    b, a = a, b
m = 0
def tiredness(n):
    sum = 0
    for i in range(1, n+1):
        sum += i

    return sum

diff = abs(a - b)
if diff == 1:
    print(1)
    exit()
m = diff // 2
if diff % 2 == 0:
    print(tiredness(abs(a - (a + m))) + tiredness(abs(b - (b - m))))
else:
    print(tiredness(abs(a - (a + m))) + tiredness(abs(b - (b - m - 1))))