# import sys
# sys.stdin=open("input1.in","r")
# sys.stdout=open("output2.out","w")
A=int(input())
B=int(input())
X=abs(A-B)
ans=0
if X%2==0:
	X=int(X/2)
	print((X*(X+1)))
else:
	X=int(X/2)
	print(X*(X+1)+X+1)
