object Main extends App {
  import scala.io.StdIn._
  val n = readInt()
  val pos = readLine.trim.split(' ').map(_.toInt)
  val min = pos.min
  val max = pos.max
  println(
    (max - min + 1) / 2
  )
}

