first=int(input())
second=int(input())
subtract=abs(first-second)
if subtract==1:
    print("1")
else:
    count=0
    k=(subtract//2)+1
    i= 1 
    while( subtract > 0):
        subtract=subtract-1
        count=count+i
        subtract=subtract-1
        count=count+i 
        i=i+1
    if subtract%2==0:
        print(count)
    else:
        print(count - k )
            
            