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

