a = int(raw_input())
b = int(raw_input())

cansaco = 0
i = 1
j = 1

while a != b:
	if a > b:
		a -= 1
		cansaco += i
		i += 1
		if a != b:
			b += 1
			cansaco += j
			j += 1
	elif a < b:
		a += 1
		cansaco += i
		i += 1
		if a != b:
			b -= 1
			cansaco += j
			j += 1

print cansaco