local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
--
local N=read.n()
local min = 1111
local max = 0
for i=1,N do
    local a = read.n()
    min=math.min(min,a)
    max=math.max(max,a)
end
print(max-min)

