a = int(raw_input())
b = int(raw_input())


m1 = abs(a-b)/2.0
m2 = abs(a-b)/2

if m1 == m2:
    p1, p2 = m2, m2
else:
    p1, p2= m2, m2+1

if abs(a - b) == 1:
    print 1
else:
    print ((1 + p1) * p1 / 2) + ((1 + p2) * p2 / 2)
