a1 = int(input())
b1 = int(input())

result = 0
plus = 1
diff = abs(a1 - b1)
while diff > 0:
    result += plus
    diff -= 1
    if diff == 0:
        break
    result += plus
    diff -= 1
    plus += 1
    
    
print(result)