a = int(input())
b = int(input())
if abs(b - a) % 2 == 0:
    some = 0
    for i in range(1 , 1 + abs(b - a) // 2):
        some += i
    print(2 * some)
else:
    some = 0
    prev = 0
    for i in range(1, 1 + abs(b - a) // 2):
        some += i
        prev = i
    i = prev
    print(some + some + (i + 1))