fun main(args: Array<String>) {
    val inp = readLine()!!.split(" ").map {
        it.toInt()
    }
    if(inp.get(0) == inp.get(1) && inp.get(0) == inp.get(2)) {
        println("0")
        return
    }
    if(inp.all{it.mod(2) == 0} || inp.all{it.mod(2) == 1}) {
        foo(inp, false)
        return
    }
    val odd = inp.filter { it.mod(2) == 0 }
    val noOdd = inp.filterNot { it.mod(2) == 0 }
    if(odd.size == 2) {
        var l = mutableListOf<Int>()
        for(i in odd) {
            l.add(i+1)
        }
        l.add(noOdd.get(0))
        foo(l,true)
    } else {
        var l = mutableListOf<Int>()
        for(i in noOdd) {
            l.add(i+1)
        }
        l.add(odd.get(0))
        foo(l,true)
    }
}

fun foo(l: List<Int>, b:Boolean) {
        val max =  l.max()
        var c = 0
        for(i in l) {
            c += if(max!! - i == 0) {
                0
            } else {
                (max - i) / 2
            }
        }
        if(b) {
            println(c+1)
            return
        }
        println(c)
}