b = int(raw_input())
a = int(raw_input())
mid = (a+b)/2
tot_mov = 0
a_mov = 0
while a < mid :
    a+=1
    a_mov+=1
b_mov = 0  
while b > mid :
    b-=1
    b_mov+=1  
while b_mov > 0 :
    tot_mov += b_mov
    b_mov -= 1
while a_mov > 0 :
    tot_mov += a_mov
    a_mov -= 1
print tot_mov  