boy1 = int(input())
boy2 = int(input())
distance = abs(boy1 - boy2)
remainder = distance % 2
if remainder == 0:
    distance1 = distance // 2 + 1
    distance2added = 0
    mySum = 0
    for i in range(1, distance1):
        mySum += i
    totalSum = mySum * 2
    print(totalSum)
elif remainder == 1:
    distance1 = distance // 2 + 1
    distance2added = 1
    mySum = 0
    for i in range(1, distance1):
        mySum += i
    totalSum = mySum * 2 + distance1
    print(totalSum)
