fun main(args: Array<String>) {
    agc008a()
}

fun agc008a() {
    val (x, y) = readLine()!!.split(" ").map { it.toLong() }

    val answer = (0..3).map { calc(x, y, it) }.min()

    println(answer)
}

fun calc(x1: Long, y1: Long, i: Int): Long {
    var x = x1
    var y = y1
    var cnt = 0L

    if (i % 2 == 0) {
        y *= -1
        cnt++
    }
    if (i shr 1 % 2 == 0) {
        x *= -1
        cnt++
    }

    return if (x <= y) y - x + cnt else Long.MAX_VALUE / 2
}
