import scala.io.StdIn.readLine

object Main extends App {
  val (x, y) = readLine.split(" ") match {
    case Array(x, y) => (x.toInt, y.toInt)
  }
  println(solve(x, y))

  def solve(x: Int, y: Int) = {
    if (x * y == 0) {
      if (x > y) x - y + 1
      else       y - x
    }
    else if ((x < 0) && (y > 0) || !(x < 0) && !(y > 0)) (x + y).abs + 1
    else {
      if (x > y) x - y + 2
      else       y - x
    }
  }
}
