#include <stdio.h>
int main() {
    int n;
    int a[10000];
    int max = 0 , min = 100;
    scanf("%d",&n);
    for (int i = 0; i<n; i++) {
        scanf("%d",&a[i]);
    } 
    for (int i = 0; i<n; i++) {
       if (max<a[i]) {
            max = a[i];
       }
       if (min>a[i]) {
            min = a[i];
       }
    } 
    printf("%d",max-min);

    return 0;
}