a = int(input(""))
b = int(input(""))
begin = 0
end = 0
if a > b :
    begin = b
    end = a
else:
    end = b
    begin = a

distance = end - begin

summation = 0

if distance % 2 == 0:
    index1 = 1
    while index1 <= distance/2:
        summation += (1 * index1 )
        index1 = index1 + 1
    index = 1
    while index <= distance/2:
        summation += (1 * index )
        index = index + 1
if distance % 2 != 0:
    index1 = 1
    while index1 <= distance/2+1:
        summation += (1 * index1 )
        index1=index1+1
    index = 1
    while index <= distance/2:
        summation += (1 * index )
        index = index + 1
print summation
