a = int(input())
b = int(input())
d = abs(a-b)
half = (d//2)

if d % 2 == 0:
    #sum of natural numbers is n(n+1)/2, one for each half so half(half+1) 
    print(half*(half+1))  
else:
    #add and additional half + 1 if the distance is odd
    print(half*(half+1) + half+1)
