a = int(input())
b = int(input())
a, b = min(a, b), max(a, b)
c1 = (a + b) // 2
c2 = (a + b + 1) // 2
ans = (1 + c1 - a) * (c1 - a) / 2
ans += (1 + b - c2) * (b - c2) / 2
if (c1 != c2):
    ans += min(c2 - a, b - c1)
print(int(ans))