a = int(input())
b = int(input())
first = 1
second = 1
tired = 0
while a != b:
	if a < b:
		if first <= second:
			first += 1
			tired += first - 1
			a += 1
		else:
			second += 1
			tired += second - 1
			b -= 1
	else:
		if first <= second:
			first += 1
			tired += first - 1
			a -= 1
		else:
			second += 1
			tired += second - 1
			b += 1
print(tired)