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

x = abs(a - b)

s = 0
if x % 2 == 0:
    for i in range(1, x // 2 + 1):
        s = s + i
    print(s * 2)

else:
    for i in range(1, x // 2 + 1):
        s = s + i
    print(s * 2 + x // 2 + 1)