#include <stdio.h>

int main() {

    int n;//输入成绩个数
    scanf("%d", &n);

    int i = 0;//输入数组
    int arr[n];//C99

    int max = 0;
    int min = 100;

    for (i=0; i<n; i++)
    {
        scanf("%d", &arr[i]);
        if (arr[i] > max)
        {
            max = arr[i];
        }

        if (arr[i] < min)
        {
            min = arr[i];
        }
    }

    int gap = max - min;//分数差
    printf("%d\n", gap);

    return 0;
}