import math

a = int(input())
b = int(input())
if a > b:
    tmp = a
    a = b
    b = tmp

if (a + b) / 2 == (a + b) // 2:
    point = (a + b) // 2
else:
    point = math.ceil((a + b) / 2)

ans = (point - a)*(point - a + 1) / 2
ans += (b - point) * (b - point + 1) / 2
print(int(ans))







