a = int(input())
b = int(input())

d = max(a-b,b-a)

if d%2 == 0:
	y = int(d/2)
else:
	y = int(d/2)+1

f1 = 0
for i in range(1,int(d/2)+1):
	f1 += i

f2 = 0
for i in range(1,y+1):
	f2 += i

if d == 1:
	print(1)
else:
	print(f1+f2)