a = int(input())
b = int(input())
health = 0
i = 1
if a > b :
    x = (a - b )// 2 + b
    while a != b:
        if a != x:
            a -= 1
            health += i
        if b != x:
            b += 1
            health += i
        i += 1
else:
    x = (b - a ) // 2 + a
    while a != b:
        if a != x:
            a += 1
            health += i
        if b != x:
            health += i
            b -= 1
        i += 1
print(health)