a=int(input())
b=int(input())
count=0
if a>b:
	dist=a-b
	x=dist//2
	for i in range(1,x+1):
		count+=i
	y=dist-x*2
	if y==0:
		count=(2*count)
	else:
		count=(2*count)+x+1
	print(count)
else:
	dist=b-a
	x=dist//2
	for i in range(1,x+1):
		count+=i
	y=dist-x*2
	if y==0:
		count=(2*count)
	else:
		count=(2*count)+x+1
	print(count)