a = int(input())
b = int(input())
dist1 = abs(a-b)//2
dist2 = abs(a-b)-abs(a-b)//2
sum = 0
for i in range(1, dist1+1 if dist1 >= dist2 else dist2+1):
    if i == (dist1 if dist1 >= dist2 else dist2) and dist1 != dist2 :
        sum+=i
    else:
        sum+=i*2
print(sum)