n=int(input())
m=int(input())
if m-n==1 or n-m==1:
    print(1)
elif m-n==2 or n-m==2:
    print(2)
elif m-n==3 or n-m==3:
    print(3)
else:
    k=0
    p=0
    x=abs(n-m)
    if x%2==0:
        x=x//2
        for i in range(x):
            f=1
            k+=f
            p+=f
            f+=1
        print(k+p)
    else:
        x=(x//2)+1
        for i in range(x):
            f=1
            k+=f
            f+=1
        for i in range(x):   
            r=1
            p+=r
            r+=1
        print(k+p)