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

	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 <- i until N){
			if(j == N-1){

				}else if(a(j) > a(j+1)){
					val t = a(j + 1)
					a(j+1) = a(j)
					a(j) = t
				}
		}
	}

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

	println(sum)


}