a=int(input());b=int(input())
d=0
diff=abs(a-b)

if not diff%2:
	if diff==2:
		print(2)
	else:
		while diff:
			d+=diff
			diff-=1
		print(d)
else:
	p1=diff//2;p2=(diff//2)+1
	while p2:
		d+=p1+p2
		p1-=1;p2-=1
	print(d)