a = int(input())
b = int(input())
s = min(a,b)
l = max(a,b)
d = l-s
t = 0
for i in range(1,d+1):
    s+=1
    t+=i
    if(l-s!=0):
        l=l-1
        t+=i
    else:
        break
        
print(t)        