a = int(input())
b = int(input())
a_tired = 0
b_tired = 0
tired = 0
while (a != b):
    if a<b:
        a += 1
        a_tired +=1
        tired+=a_tired
        if a == b:
            break
        else:
            b-=1
            b_tired +=1
            tired+=b_tired
    elif a>b:
        b += 1
        b_tired +=1
        tired+=b_tired
        if a == b:
            break
        else:
            a-=1
            a_tired +=1
            tired+=a_tired
print(tired)
            
