fun main(args: Array<String>) {
    var ABC = listOfInt()
    val max = ABC.max()!!
    val sum = ABC.sum()
    val M = if (sum % 2 == max % 2) max else max + 1
    val ans = (M * 3 - sum) / 2
    println(ans)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt(d: Int = 0) = listOfString().map { it.toInt() + d }
