a=int(input())
b=int(input())
diff=abs(a-b)
odd=False
if diff&1==1:
	odd=True
diff=diff//2
first=(diff*(diff+1))//2
if odd:
	diff+=1
	second=(diff*(diff+1))//2
	print(first+second)
else:
	print(first*2)