fun readInts() = readLine()!!.split(' ').map(String::toInt)

fun main(args: Array<String>) {
    val (a, b, c) = readInts().sorted()
    val d = c - a + c - b
    println(if (d == 0) 0 else if (d % 2 == 0) d / 2 else d / 2 + 2)
}
