from math import ceil
a = int(input())
b = int(input())
 
if a > b:
    a, b = b, a
 
mid = (a + b) // 2
counter = 1
first = 0
for i in range(a, b):
    first += counter
    counter += 1
 
second = 0
counter = 1
 
for i in range(min(mid - a, b - mid)):
    second += counter
 
    counter += 1
 
second *= 2
 
if (mid - a) != (b - mid):
    second += counter
 
print(min(first, second))