a = int(input())
b = int(input())
a_steps, b_steps = 0, 0
def get_tiredness(s):
    t = 0
    for i in range(1, s + 1):
        t += i
    return t

if b - a > 1:
    while b - a > 1:
        a_steps += 1
        b_steps += 1
        a += 1
        b -= 1
elif a - b > 1:
    while a - b > 1:
        a_steps += 1
        b_steps += 1
        a -= 1
        b += 1
if a - b == 1 or b - a == 1: 
    a_steps += 1
    a = b
print(get_tiredness(a_steps) + get_tiredness(b_steps))

        
