a=int(input())
b=int(input())
m=(a+b)//2
sum1=0
sum2=0
if(a==m):
	print(abs(m-b))
if(b==m):
	print(abs(m-a))
if(a!=m and b!=m):
	z=abs(m-a)
	for i in range(1,z+1):
		sum1=sum1+i
	q=abs(m-b)
	for j in range(1,q+1):
		sum2=sum2+j
	print(sum1+sum2)