'use strict'

function main(input) {
    input = input.split(/\n|\s/).map(v => ~~v)
    let A = input[0]
    let B = input[1]
    let C = input[2]

    const sum = A + B + C
    let goal = Math.max.apply(null, input) * 3

    if (sum % 2 == goal % 2) {
        // console.log(sum % 2, goal % 2)
    } else {

        goal += 3
    }

    const ans = Math.ceil((goal - sum) / 2)

    console.log(ans)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));