
l = []
l.append(int(input()))
l.append(int(input()))

l.sort()
n = l[0]
m = l[1]

t = 1
tot = 0
while n != m:
	n += 1
	tot += t
	if n == m:
		print(tot)
		exit()
	
	m -= 1
	tot += t
	if n == m:
		print(tot)
		exit()

	t += 1
