# cook your dish here
n1 = int(input())
n2 = int(input())
power = 0
total = 0
if (n1 > n2):
    temp = n1
    n1 = n2
    n2 = temp
while (n2 - n1 > 1):
    power += 1
    n1 += 1
    n2 -= 1
    total += 2 * power
if (n2 - n1 == 1):
    power += 1
    total += power
print(total)