object Main extends App{
val n = scala.io.StdIn.readInt
val a_list = scala.io.StdIn.readLine.split("\\s").map(_.toInt)

val max_int = a_list.max

val min_int = a_list.min

println(max_int - min_int)
}