fun main(args: Array<String>) {
    var ABC = readLine()!!.split(" ").map(String::toInt)

    if (ABC[0] == ABC[1] && ABC[1] == ABC[2]) {
        println(0)
        return
    }

    val oddCount = ABC.count { it % 2 == 1 }

    var count = 0
    if (oddCount == 1 || oddCount == 2) {
        count++
    }
    ABC = ABC.map {
        if (oddCount == 1 && it % 2 == 0) {
            it + 1
        } else if (oddCount == 2 && it % 2 == 1) {
            it + 1
        } else {
            it
        }
    }

    var array = ABC.toIntArray()
    while (true) {
        if (array[0] == array[1] && array[1] == array[2]) {
            println(count)
            return
        }
        array[array.indexOfFirst { it == array.min() }] += 2
        count++
    }

}


