a=int(input())
b=int(input())
e=0
if (abs(a-b))%2==0:
    for i in range(1,(abs(a-b))//2+1):
        e+=(i*2)
else:
    if abs(a-b)==1:
        e+=1
    else:
        for i in range(1,(abs(a-b))//2+1):
            e+=(i*2)
        e+=((abs(a-b))//2+1)
print(e)
    
    
