x1 = int(raw_input())
x2 = int(raw_input())
dis = abs(x1-x2)

def f(n):
    if n == 0:
        return 0
    if n == 1:
        return 1
    if n > 1:
        return f(n - 1) + n

c1 = dis/2
if dis%2 == 0:
	print f(c1) + f(c1)
else:
	print f(c1) + f(c1+1)

