import math
a=int(input())
b=int(input())
f=int(math.fabs(a-b)//2)
s=int(math.fabs(a-b)//2)
f1=0
s1=0
if math.fabs(a-b)%2!=0:
    f+=1
for i in range(f+1):
    f1+=i
for i in range(s+1):
    s1+=i
print(s1+f1)