import math

a = int(input()) 
b = int(input()) 
if(a>b):
    temp =a 
    a=b
    b=temp
else:
    pass

point = math.ceil ((b+a)/2) 
if((b-a)==1 or (a-b)==-1):
    print(1) 
else:
    distance1 = point - a 
    distance2 = b - point 
    tired1 = (distance1)*(distance1+1)/2 
    tired2 = (distance2)*(distance2+1)/2
    print(int(tired2+tired1))


