
a = int(input())
b = int(input())
if a > b:
    a, b = b, a
step = 0
tmp = (b - a) // 2
for i in range(1, tmp + 1):
    a += i
    b -= i
    step += 2*i
if a != b:
    print(step + (tmp+1))
else:
    print(step)
# HaPpY NoWrUz 1398
# UBCF
# CodeForcesian
# ♥
# نشکن دلمو
