import sys 

I=sys.stdin.readline

a=int(I())
b=int(I())

tired=0
a_tired=0
b_tired=0
if a>b:
	flag=0
else:
	flag=1
while a!=b:
	if a>b:
		if flag==0:
			a_tired+=1
			tired+=a_tired
			a-=1
			flag=1
		else:
			b_tired+=1
			tired+=b_tired
			b+=1
			flag=0

	else:
		if flag==0:
			a_tired+=1
			tired+=a_tired
			a+=1
			flag=1
		else:
			b_tired+=1
			tired+=b_tired
			b-=1
			flag=0
print(tired)
