let N=Int(readLine()!)!
var A=[Int]
for i in 0..<N{
  A.append=Int(readLine()!)!
}
var min=A[0]
var max=A[0]
for i in 1..<N{
  if (min>A[N]){
    min=A[N]
  }
}
for i in 1..<N{
  if (max<A[N]){
    max=A[N]
  }
}
print(max-min)