#include <iostream>
using namespace std;
int Shortest(int arr[], int len){
int s=arr[0];
for(int i=1; i<=len-1; i++){
if(arr[i]<s) s=arr[i];
}return s;
}
int Tallest(int arr[], int len){
int s=arr[0];
for(int i=1; i<=len-1; i++){
if(arr[i]>s) s=arr[i];
}return s;
}
int main(){
int n;
int arr[100];
cin>>n;
for(int i=0; i<=n-1; i++) cin>>arr[i];
cout<<Tallest(arr,n)-Shortest(arr,n);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgU2hvcnRlc3QoaW50IGFycltdLCBpbnQgbGVuKXsKICBpbnQgcz1hcnJbMF07CiAgZm9yKGludCBpPTE7IGk8PWxlbi0xOyBpKyspewogICAgaWYoYXJyW2ldPHMpIHM9YXJyW2ldOwogIH1yZXR1cm4gczsKfQppbnQgVGFsbGVzdChpbnQgYXJyW10sIGludCBsZW4pewogIGludCBzPWFyclswXTsKICBmb3IoaW50IGk9MTsgaTw9bGVuLTE7IGkrKyl7CiAgICBpZihhcnJbaV0+cykgcz1hcnJbaV07CiAgfXJldHVybiBzOwp9CmludCBtYWluKCl7CiAgaW50IG47CiAgaW50IGFyclsxMDBdOwogIGNpbj4+bjsKICBmb3IoaW50IGk9MDsgaTw9bi0xOyBpKyspIGNpbj4+YXJyW2ldOwogIGNvdXQ8PFRhbGxlc3QoYXJyLG4pLVNob3J0ZXN0KGFycixuKTsKfQ==