a, b = int(input()), int(input())

dist = abs(b - a)

dp = [float("inf") for i in range(dist + 2)]

dp[0] = 0
dp[1] = 1

for i in range(1, dist):
    dp[i + 1] = min(dp[i + 1], dp[i] + i)
    dp[i + 2] = min(dp[i + 2], dp[i] + 2 * i)

print(dp[dist])