x  = int(input())
y = int(input())
tired = 1
total = 0
a = max(x, y)
b = min(x, y)
while a != b:
    if  a-b >= 2:
        b +=2
        total += tired *2
        tired += 1
    else:
        b += 1
        total += tired
print(total)