a = int(input())
b = int(input())
sum = 0
#tiredness = [item for item in range(abs(a - b))]
for i in range((abs(a - b)) // 2):
     sum += i+1
if abs(a - b) % 2 == 0:
     for i in range((abs(a - b)) // 2):
          sum += i+1
else:
     for i in range(abs((a - b)) // 2 + 1):
          sum += i+1
print(sum)