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

tiredness1 = 0
tiredness2 = 0

steps = 1


if a < b:
	while a != b:
		a += 1
		tiredness1 += 1 * steps
		if a != b:
			b -= 1
			tiredness2 += 1 * steps
		steps += 1

elif a > b:
	while a != b:
		b += 1
		tiredness2 += 1 * steps
		if a != b:
			a -= 1
			tiredness1 += 1 * steps
		steps += 1

print(tiredness1 + tiredness2)