def solve(first, second):
	result = 0
	first_tired = 1
	second_tired = 1
	swing = True
	
	if first > second:
		first, second = second, first
	
	while first < second:
		if swing:
			first += 1
			result += first_tired
			first_tired += 1
			swing = not swing
		else:
			second -= 1
			result += second_tired
			second_tired += 1
			swing = not swing
	
	return result


if __name__ == "__main__":
	first_friend = int(input())
	second_friend = int(input())
	
	print(solve(first_friend, second_friend))