import scala.io.StdIn._
object Main extends App {
  var arr = readLine().split(" ").map(_.toInt)

  var count = 0
  while (arr(0) != arr(1) || arr(1) != arr(2)) {
    arr = arr.sorted
    if (arr(0) == arr(1)) {
      arr(0) += 1
      arr(1) += 1
      count += 1
    } else {
      arr(0) += 2
      count += 1
    }
  }
  println(count)
}