cordinateA = int(raw_input())
cordinateB = int(raw_input())

tirednessA = 0
tirednessB = 0
pointer1 = cordinateA
pointer2 = cordinateB

while(pointer1 != pointer2):
    if(cordinateA < cordinateB):
        if(tirednessA < tirednessB):
            pointer1 += 1
            tirednessA += pointer1 - cordinateA
        else:
            pointer2 -= 1
            tirednessB += cordinateB - pointer2
    if(cordinateA > cordinateB):
        if(tirednessA < tirednessB):
            pointer1 -= 1
            tirednessA += cordinateA - pointer1
        else:
            pointer2 += 1
            tirednessB += pointer2 - cordinateB
print(tirednessA + tirednessB)