a = int(input())
b = int(input())
count=0
if abs(a-b)%2!=0:
	for i in range(0,abs(a-b)//2+1):
		if i>=0:
			count+=i+1
		if i>=1:
			count+=i
else:
	for i in range(0,abs(a-b)//2):
		if i>=0:
			count+=i+1
		if i>=0:
			count+=i+1

print(count)		