x = int(raw_input())
y = int(raw_input())
diff = abs(y-x)
if diff==1:
    print 1
elif diff%2 == 0:
    diff/=2
    diff = range(0,diff+1)
    print sum(diff)*2
else:
    diff/=2
    diff = range(0,diff+1)
    print sum(diff)*2+1+diff[len(diff)-1]    
        