x = int(raw_input())
y = int(raw_input())

aux = x
x = min(x, y)
y = max(aux, y)

aux = 1

x_ = 0
y_ = 0

while x != y:
    x += 1
    x_ += aux
    if x == y: break

    y -= 1
    y_ += aux
    if x == y: break
    aux += 1

print x_+y_