a=int(input())
b=int(input())
c=int()
k=0
m=0
if a>b :
    c=a-b
else :
    c=b-a
if c%2==0:
    c=c//2
    for i in range(0,c+1):
        k=k+i
    for i in range (c,0,-1):
        m=m+i
else:
    c=c//2
    for i in range(0,c+1):
        k=k+i
    for i in range (c+1,0,-1):
        m=m+i
print(k+m)
    
    
        
        
    
    
    
    
        
            
            
    
    
