import java.util.*

val ans = mutableListOf<Int>()

fun main(args: Array<String>) {
	val sc = Scanner(System.`in`)
	val x = sc.nextInt()
	val y = sc.nextInt()

	for (i in 0 until 4) {
		solve(i, x, y)
	}
	println(ans.min())
}

fun solve(i: Int, x0: Int, y0: Int) {
	var x = x0
	var y = y0
	var t = 0

	if (i % 2 == 0) {
		x *= -1
		t++
	}
	if (i < 2) {
		y *= -1
		t++
	}
	if (x <= y) {
		t += y - x
		ans.add(t)
	}
}
