def main():
	friend1_pos = int(input())
	friend2_pos = int(input())

	f1_exhaustion = 0
	f2_exhaustion = 0

	exhaustion_iterator = 1

	if(friend1_pos < friend2_pos):
		while(friend1_pos != friend2_pos):
			friend1_pos += 1
			f1_exhaustion += exhaustion_iterator

			if(friend1_pos == friend2_pos):
				return f1_exhaustion + f2_exhaustion

			friend2_pos -= 1
			f2_exhaustion += exhaustion_iterator

			if(friend1_pos == friend2_pos):
				return f1_exhaustion + f2_exhaustion

			exhaustion_iterator += 1
	else:
		while(friend1_pos != friend2_pos):
			friend1_pos -= 1
			f1_exhaustion += exhaustion_iterator

			if(friend1_pos == friend2_pos):
				return f1_exhaustion + f2_exhaustion

			friend2_pos += 1
			f2_exhaustion += exhaustion_iterator
			if(friend1_pos == friend2_pos):
				return f1_exhaustion + f2_exhaustion

			exhaustion_iterator += 1

print(main())