object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(xa, xb, xMax) = readLine.split(" ").map(_.toInt).sorted

    // make Xa = Xb
    val count2 = (xb - xa) / 2
    val count1 = (xb - xa) % 2
    // mak Xb = xa = xb
    val count3 = (xMax + count1) - xb

    println(count1 + count2 + count3)
  }
}
