#include <stdio.h>

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