local N = io.read("*n")
local A = {}
for i = 1, N do
    A[i] = io.read("*n")
end

local biggest, smallest = 0, 1000000000
for i = 1, N do
    if biggest < A[i] then
        biggest = A[i]
    end
    if smallest > A[i] then
        smallest = A[i]
    end
end
print(biggest - smallest)