#include <stdio.h>
#include <string.h>
int main(void)
{
	int N,a[100],i;
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&a[i]);}
		qsort(a,N,sizeof(int),strcmp);
		printf("%d\n",a[N-1]-a[0]);
	return 0;
}
