n1 = input()
n2 = input()

d = abs(n1 - n2)

div1 = None
div2 = None

if (d % 2 == 0):
	div1 = d/2
	div2 = d/2
else:
	div1 = d/2
	div2 = d - div1

soma = 0

for i in range(1,div1+1):
	soma+=i

for i in range(1,div2+1):
	soma+=i
print(soma)