a = input()
b = input()
a = int(a)
b = int(b)
if abs(a-b) == 1:
    print("1")
else:
    mid = (a+b)/2
    n1 = abs(mid - a)
    n2 = abs(mid - b)
    sum = n1*(n1+1)/2
    sum += n2*(n2+1)/2
    print(sum)