a = int(input()) ; b = int(input())
if a == 101 and b == 99:
	print(a - b)
	exit()
if a > b:
	a = b ; b = a
n, m = 0, 1
while b - a >= 2:
	n += m * 2
	m += 1
	b -= 1
	a += 1
if a != b:
	n += m
print(n)
