let i=readLine()!.characters.split(" ").map{Int(String($0))!},x=i[0],y=i[1]
var ans=Int(2e9)
func f(a:Int, _ b:Int, _ c:Int) {
  if b <= a {
    ans=min(ans,b-a+c)
  }
}
f(x,y,0)
f(x,-y,1)
f(-x,y,1)
f(-x,-y,2)
print(ans)