a = int(input())
b = int(input())

id_end = round((a + b)/2)

hunger_a = 0
hunger_b = 0

if a < b:
	i = 0
	while a != id_end:
		i += 1
		hunger_a += i
		a += 1
	i = 0
	while b != id_end:
		i += 1
		hunger_b += i
		b -= 1
else:
	i = 0
	while a != id_end:
		i += 1
		hunger_a += i
		a -= 1
	i = 0
	while b != id_end:
		i += 1
		hunger_b += i
		b += 1

print(hunger_a + hunger_b)