a = int(input())
b = int(input())
m = (a+b)//2 + (a+b)%2
a,b = min(a,b), max(a,b)
a1 = 0
b1 = 0
for i in range(a,m+1):
    a1+= i-a
for i in range(m,b):
    b1+= b-i
if b-a == 1:
    print(1)
else:
    print(a1+b1)