fun main(args: Array<String>) {
    val (x, y) = readLine()!!.split(" ").map{it.toLong()}

    var res = 1e18.toLong()

    for (a in -1 .. 1 step 2) for (b in -1 .. 1 step 2) {
        val s = x * a
        val t = y * b

        if (s > t) {
            continue
        }
        var u = t - s
        if (a < 0) u++
        if (b < 0) u++
        res = Math.min(u, res)
    }

    println(res)
}
