a = int(input())
b = int(input())

diff = max(a,b) - min(a,b)
ans = 0

for i in range(1, 100000):
    if diff >= 2:
        diff-=2
        ans+=(2*i)
        
    else:
        diff-=1
        ans+=i
        
    if diff==0:
        break
        
print(ans)