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

s = abs(a - b)
sum = 0

if s % 2 == 0:
    for i in range(1, s // 2 +1):
        sum += 2*i
else:
    for i in range(1,s // 2 + 1):
        sum += 2*i
    sum += s // 2 + 1
    
print(sum)