#include<stdio.h>
int main() {
    int n,N;
    int min = 100;
    int max=0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &N);

        if (N > max)
            max = N;
        if (N < min)
            min = N;
    }



    printf("%d", max - min);
}