a,b=map(int,input().split()) a,b=min(a,b),max(a,b) ans=1000 for i in range(a+1): t=i f=a-i t,f=t+a-f,f+b-i ans=min(ans,abs(t-f)) print(ans)