fun main(args: Array<String>) {
  val xs = readLine()!!.split(" ").map(String::toInt)
  var minCount = xs.sum()!!
  for (k in xs.min()!!..xs.max()!!) {
    val count = xs.map {
      val delta = k - it
      if (delta >= 0) {
        if (delta % 2 == 0) delta / 2
        else delta / 2 + 2
      } else {
        -delta
      }
    }
        .sum()!!
    minCount = Math.min(minCount, count)
  }
  println(minCount)
}