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

menor = min(a, b)
maior = max(a, b)

total = 0
aux = 1
while True:
    if maior == menor: break
    menor += 1
    total += aux

    if maior == menor: break
    maior -= 1
    total += aux

    aux += 1

print(total)

 	 		 	   		 	 	   						 		  	