#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int a[100],n;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i]
		sort(a,a+n)
	}
	printf("%d\n",a[n-1]-a[0] );
	return 0;
}