a=int(input())
b=int(input())
if a<b:
    i,j=1,1
    sum1,sum2=0,0
    while a!=b:
        sum1+=i
        a+=1
        i+=1
        if a!=b:
            sum2+=j
            b-=1
            j+=1
        else:
            break
    print(sum1+sum2)
else:
    a,b=b,a
    i,j=1,1
    sum1,sum2=0,0
    while a!=b:
        sum1+=i
        a+=1
        i+=1
        if a!=b:
            sum2+=j
            b-=1
            j+=1
        else:
            break
    print(sum1+sum2)
