x1 = int(raw_input())
x2 = int(raw_input())

resp = 0

if x1 > x2:
    i = 1
    move_x1 = True
    while x1 != x2:
        if move_x1:
            x1 -= 1
            resp += i
            move_x1 = False
        else:
            x2 += 1
            resp += i
            i += 1
            move_x1 = True
elif x2 > x1: # x2 > x1
    i = 1
    move_x2 = True
    while x1 != x2:
        if move_x2:
            x2 -= 1
            resp += i
            move_x2 = False
        else:
            x1 += 1
            resp += i
            i += 1
            move_x2 = True

print resp