a=int(input())
b=int(input())
if a>b:
    a,b=b,a
s=0
c1=1
c2=1
i=1
while True:
    if a==b:
        break
    if i%2!=0:
        a=a+1
        s=s+c1
        c1=c1+1
    else:
        b=b-1
        s=s+c2
        c2=c2+1
    i=i+1
print(s)