from functools import reduce
def s(n):
	n=reduce(lambda x,y:x+y,range(1,n+1))
	return n
x=abs(int(input())-int(input()))
if x==1:
	print(1)
	exit()
if x%2==0:
	print(2*s(x//2))
else:
	print(2*s(x//2)+(1+x//2))