#include <stdio.h>

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