def tr(x):
    c = 0
    for i in range(x):
        c += i+1
    return c

def mintr(a,b):
    dif = abs(a-b)
    if dif%2 == 0:
        return 2*tr(int(dif/2))
    else:
        return tr(dif//2)+tr(dif//2 + 1)

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

print(mintr(a,b))
