n=int(input())
m=int(input())
a=max(n,m)
b=min(n,m)
if (a-b-1)%2==0:
	l=int((a-b-1)/2)
	sum1=0
	for i in range(1,l+1):
		sum1+=(i)
	print(2*sum1+l+1)
else:
	sum1=0
	l=int(((a-b)+1)/2)
	for i in range(1,l+1):
		sum1+=i
	print(2*sum1)
