open System


[<EntryPoint>]
let main argv =
    let n =stdin.ReadLine()|>int
    stdin.ReadLine().Split()
    |>Array.map int
    |>fun c -> ((Array.max c)-(Array.min c))
    |>stdout.WriteLine
    0