a = int(input())
b = int(input())
c = 0
turn = 0
while a != b:
	turn += 1
	if a > b:
		a -= 1
		c += turn
		if b < a:
			b += 1
			c += turn
	elif b > a:
		b -= 1
		c += turn
		if a < b:
			a += 1
			c += turn
print(c)