a = int(raw_input())
b = int(raw_input())

distance = max(a, b) - min(a, b)

a_d = distance / 2
b_d = a_d

if distance % 2 != 0:
    b_d = a_d + 1

total_walked = 0

for i in range(1, a_d + 1):
    total_walked += i

for i in range(1, b_d + 1):
    total_walked += i

print(total_walked)