import sys


def compute_sum(n):
    s = 0
    for i in range(1, n + 1):
        s += i
    return s

def main():
    a = int(sys.stdin.readline())
    b = int(sys.stdin.readline())

    low, high = min(a, b), max(a, b)
    total = (high - low) // 2
    friend1 = compute_sum(total)
    friend2 = friend1
    if (high - low) % 2 == 1:
        friend2 += total + 1

    print(friend1 + friend2)


if __name__ == '__main__':
    main()
