def som(n):
	if(n==1):
		sum = 1
	else:
		sum = n/2*(2 + (n-1))
	return int(sum)

x = int(input())
y = int(input())
tire = 0
mean = (x+y)//2

if(x == y+1 or y == x+1):
	u = 0
	v = 1

else:
	a = mean - x
	b = y - mean

	if(a < 0):
		a = -1*(a)
		b = -1*(b)

	if(a == 1 and b == 1):
		u = 1
		v = 1

	else:
		u = som(a)
		v = som(b)


tire = u+v
print(tire)
