def main():
    total = 0
    l = []

    x1 = input()
    x2 = input()

    l.append(x1)
    l.append(x2)

    l = sorted(l)

    if (l[1] - l[0]) % 2 == 0:
        passos = (l[1] - l[0]) / 2

        for i in range(1, passos + 1):
            total = total + i

        total = total * 2
    else:
        passos = ((l[1] - l[0]) / 2) + 1

        for i in range(1, passos + 1):
            total = total + i

        total = (total * 2) - (passos)


    print total


main()