# Contest 1
# Matheus Silva Araujo
# Friends Meeting

a = int(raw_input())
b = int(raw_input())

if a > b:
    aux = a
    a = b
    b = aux

m = b - a

if m % 2 == 0:
    m /= 2
    print m*(m + 1)

else:
    m = a + b
    n = m / 2
    p = n - a

    n -= b
    print (p*(p + 1))/2 + (n*(n + 1))/2

 



	  	 			  		 	   		 			  				