#import sys
#sys.stdin = open("input.in","r")
#sys.stdout = open("test.out","w")
n=int(input())
m=int(input())
c=(n+m) // 2
l=0
for i in range(abs(c-n)):
  l+= i+1
for j in range(abs(m-c)):
  l+= j+1
print(l)