import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val a = scanner.nextInt()
    val b = scanner.nextInt()
    val c = scanner.nextInt()

    if (a == b && b == c) {
        println(0)
        return
    }

    val dp = Array(70) {
        Array(70) {
            Array(70) { Int.MAX_VALUE }
        }
    }

    dp[a][b][c] = 0

    (a until 60).forEach { i ->
        (b until 60).forEach { j ->
            (c until 60).forEach { k ->
                if (dp[i][j][k] != Int.MAX_VALUE) {
                    dp[i + 2][j][k] = Math.min(dp[i + 2][j][k], dp[i][j][k] + 1)
                    dp[i][j + 2][k] = Math.min(dp[i][j + 2][k], dp[i][j][k] + 1)
                    dp[i][j][k + 2] = Math.min(dp[i][j][k + 2], dp[i][j][k] + 1)
                    dp[i + 1][j + 1][k] = Math.min(dp[i + 1][j + 1][k], dp[i][j][k] + 1)
                    dp[i + 1][j][k + 1] = Math.min(dp[i + 1][j][k + 1], dp[i][j][k] + 1)
                    dp[i][j + 1][k + 1] = Math.min(dp[i][j + 1][k + 1], dp[i][j][k] + 1)

                    (1 until 70).forEach { v ->
                        if (dp[v][v][v] != 0 && dp[v][v][v] != Int.MAX_VALUE) {
                            println(dp[v][v][v])
                            return
                        }
                    }
                }
            }
        }
    }
}