#include <stdio.h>

int main() {
    int n,a[100000],i,min=100,max=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(min>a[i]) min=a[i];
        if(max<a[i]) max=a[i];
    }
    printf("%d",max-min);
    return 0;
}