import io.StdIn.readLine


object Main {
  def main(args: Array[String]): Unit = {
    val Array(x, y) = readLine().split(' ' ).map(_.toInt)
    val xa = Math.abs(x)
    val ya = Math.abs(y)

    if (x == y) println(0)
    else if (xa == ya) println(1)
    else if (x < y) {
      if (x < 0) {
        if (y <= 0) println(y - x)
        else if (ya < xa) println(y - x)
        else println(ya - xa + 1)
      } else if (x > 0) println(y - x)
      else println(y)
    } else {
      if (x < 0) println(ya - xa + 2)
      else if (ya > xa) println(ya - xa + 1)
      else if (y == 0) println(xa + 1)
      else println(xa - ya + 2)
    }
  }

}
