import math
a=int(input())
b=int(input())
if abs(b-a)==1:
	print(1)
	exit(0)
	
if (a+b)%2==0:
	m=(a+b)//2
	n=abs(a-m) 
	res=n*(n+1)
	print(res)
else:
	m=(a+b)//2
	if a<b:
		n=abs(a-m)
	else:
		n=abs(b-m)
	res=n*(n+1)//2+(n+1)*(n+2)//2 
	print(res)
	
		