#include <stdio.h>

int main()
{
    int n = 0;
    int score = 0; //用于接收输入的值
    //输入
    scanf("%d", &n);
    int max = 0;
    int min = 100;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &score);
        if (score > max)
        {
            max = score;
        }
        if (score < min)
        {
            min = score;
        }
    }
    //输出
    printf("%d\n", max - min);

    return 0;
}