#include<algorithm>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<valarray>
#include<vector>
#include<map>
#include<list>
#include<bitset>
#include<stdio.h>
#include<sstream>
#include<string>
#include<functional>
#include<utility>
using namespace std;
using ll = long long;
using uint = unsigned;
using llu = long long unsigned int;
using vec = vector<int>;
using val = valarray<int>;
using pr = pair<int, int>;
template<class iterator_t>
class range
{
	iterator_t _first, _last;
public:
	range(iterator_t first, iterator_t last) :_first(first), _last(last) {}
	iterator_t begin() { return _first; }
	iterator_t end() { return _last; }
	reverse_iterator<iterator_t> rbegin() { return std::make_reverse_iterator(_last); }
	reverse_iterator<iterator_t> rend() { return std::make_reverse_iterator(_first); }
	size_t size() { return std::distance(_first, _last); }
};
template<class T>T begin(range<T> _range) { return _range.begin(); }
template<class T>T end(range<T> _range) { return _range.end(); }
template<class T>T rbegin(range<T> _range) { return _range.rbegin(); }
template<class T>T rend(range<T> _range) { return _range.rend(); }
string to_string(bool _Val) { return (_Val) ? "true" : "false"; }
struct start { start() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }start;
inline void in() {}
template <class Head, class... Tail>
inline void in(Head&& head, Tail&&... tail) { cin >> head;	in(move(tail)...); }
template <class T>
inline void in(range<T> _range) { for (auto&&i : _range) in(i); }
template <char split = '\n', class T>
inline void out(T t) { cout << t << split; }
template <char split = ' ', class Head, class... Tail>
inline void out(Head head, Tail... tail) { out<split>(head); out(move(tail)...); }
template <char split = '\n', class T>
inline void out(range<T> _range) { for (auto&& bg = _range.begin(), &&ed = _range.end(); cout << *bg++, bg != ed; cout << split) {}cout << endl; }
template<class T = int>
inline T read()
{
	T x = 0, f = 1; char ch = getchar();
	while (ch<'0' || ch>'9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0'&&ch <= '9') { x = 10 * x + ch - '0'; ch = getchar(); }
	return x * f;
}
template<class T>
T GCD(T x, T y)
{
	T temp;
	while (y != 0) {
		temp = y;
		y = x % y;
		x = temp;
	}
	return x;
}
template<class T>
T LCM(T x, T y) { return x * y / GCD<T>(x, y); }
constexpr int operator"" _i(long double x) { return (int)x; }
#define all(x) begin(x),end(x)
#define rall(x) rbegin(x),rend(x)
#define allrange(x) range(all(x))
#define abs(a) ((a) < 0 ? - (a) : (a))
#define rep_(n) for(int i##n =0;i##n <n;++i##n)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define reps(i,n) for(int i=1;i<=n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define rreps(i,n) for(int i=n;i>0;--i)
#define each(i,ary) for(auto&& i:ary)
#define loop(i,l,r) for(int i=(l);i<r;++i)
#define declare_i(...) int __VA_ARGS__;in(__VA_ARGS__);
#define chmax(max,num) (max)=((max)<(num))?(num):(max);
#define chmin(min,num) (min)=((num)<(min))?(num):(min);
#define ary_sum(ary) accumulate(all(ary),0)
#define ary_max(ary) (*max_element(all(ary)))
#define ary_min(ary) (*min_element(all(ary)))
#define ERASE(ary,target) ary.erase(remove(all(ary), target), ary.end())
#define UNIQUE(ary) ary.erase(unique(all(ary)), ary.end() )
#define tmax(type) numeric_limits<type>::max()
#define tmin(type) numeric_limits<type>::min() 
#ifdef LOCAL
#define dump(items) for(auto&& item:items){cout<<item<<endl;}
#define dumps(...) for(auto&& item:{__VA_ARGS__}){cout<<item<<endl;}
#define STOP scanf_s("%*s");return 0;
#else
#define dump(...)
#define dumps(...)
#define STOP return 0;
#endif


int main()
{
	int n = read();
	int max = tmin(int), min = tmax(int);
	rep(i, n)
	{
		int temp = read();
		chmax(max, temp); chmin(min, temp);
	}
out(max-min);
	STOP;
}


Measured memory_bytes: 256