def solve():
    a,b = int(input()),int(input())
    m = abs(a-b)
    numbers = list(range(1,m+1))
    ans = sum(numbers)
    for i in range(1,m):
        ans = min(ans,sum(numbers[0:m-i])+sum(numbers[0:i]))
    print(ans)


solve()
# t = int(input())
# for i in range(t):
#     solve()
#
