#include <stdio.h>

int main() {
    int n = 0;
    int i = 0;
    int max = 0;
    int min = 100;
    int num = 0;
    scanf("%d",&n);
    for(i = 0;i<n;i++)
    {
        scanf("%d ",&num);
        if(num>max)
        {
            max = num;
        }
        if(num<min)
        {
            min = num;
        }
    }
    printf("%d",max-min);
    return 0;
}