#include <stdio.h>
#include <math.h>
int main()
{
int i,n,max = -1, min = 2147483647;
scanf("%d", &n);
for(i = 0;i < n;i++){
int temp;
scanf("%d", &temp);
if(temp > max) max = temp;
if(temp < min) min = temp;
}
printf("%d", max - min);
return 0;
}