const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {

    const lines = input.split('\n')
    const A = lines[0].split(' ').map(Number)

    A.sort((a, b) => b - a)

    const diff = (A[0] - A[1]) + (A[0] - A[2])
    const ans = Math.ceil(diff / 2) + diff % 2

    console.log(ans)

})(input)
