
a=int(input())
b=int(input())
k=0
if(a>b):
    k=a-b
else:
    k=b-a
i,j=0,0
total_iter=0
#import timeit

#start = timeit.default_timer()

#Your statements here
for m in range(1,(k//2)+1):
    i+=m
    total_iter=m
total=2*i
if(k%2!=0):
    total+=k-total_iter
print(total)
#stop = timeit.default_timer()
#print (stop - start)




