object Main extends App {
	val N = scala.io.StdIn.readInt
	val x = scala.io.StdIn.readLine

	var a: Array[Int] = new Array(N)

	for(i <- 0 until N){
		a(i) = x.split(" ")(i).toInt
	}


	for(i<- 0 until N){
		for(j <- N-1 until i by -1){
			if(a(j-1) > a(j)){
				val t = a(j-1)
				a(j-1) = a(j)
				a(j) = t
			}

		}
	}

	val sum = a(N-1) - a(0)

	println(sum)


}