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()

    val list = listOf(A, B, C).sorted()

    var base = list[2]
    var m = list[1]
    var n = list[0]
    
    var count = 0
    while (true) {
        if (m - n >= 2) {
            n += 2
        }
        else if (m - n == 1) {
            base += 1
            n += 1
        }
        else {
            if (base > m) {
                m += 1
                n += 1
            }
            else {
                break
            }
        }
        count += 1
    }

    println(count)
}