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

acount = 0
bcount = 0

aturn = True
total = 0

if (a < b):
    t = a
    a = b
    b = t

while (a!=b):
    if (aturn):
        a -= 1
        acount += 1
        total += acount
    else:
        b += 1
        bcount += 1
        total += bcount
    aturn = not aturn

print(total)