import java.lang.Math.abs
import java.util.Collections.max
import java.util.Collections.min

fun main(args: Array<String>) {
    readLine()
    val a = readLine()!!.split(' ').map(String::toInt)
    val max = max(a)
    val min = min(a)
    print(abs((max - min)))
}