a = int(input())
b = int(input())
d = abs(a - b)
s = 0
c = 0
if d % 2 == 0:
    s += (d // 2)
    for i in range(1, s + 1):
        c += i
    print(c * 2)
    exit()
else:
    s += (d // 2)
    k = 0
    for i in range(1, s + 1):
        c += i
        k = i
    c = c * 2
    c += (k + 1)
    print(c)
