import sys
def cal(n1,n2):
    t=0
    t1=1
    t2=1
    i=min(n1,n2)
    j=max(n1,n2)
    while(i<=j):
        
        if(i==j):
            return t
        i+=1
        t+=t1
        t1+=1
        if(i==j):
            return t
        
        j-=1
        t+=t2
        t2+=1
        if(i==j):
            return t

    return t

def main():
    n1=int(input())
    n2=int(input())
    x=cal(n1,n2)
    print(x)
if __name__=="__main__":
    main()
