#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n;cin>>n;
int a[n];
int min=INT_MAX;
int max=INT_MIN;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
if(a[i]>max)
{
max=a[i];
}
}
for(int i=0;i<n;i++)
{
if(a[i]<min)
{
min=a[i];
}
}
cout<< max-min;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKaW50IG47Y2luPj5uOwppbnQgYVtuXTsKaW50IG1pbj1JTlRfTUFYOwppbnQgbWF4PUlOVF9NSU47CmZvcihpbnQgaT0wO2k8bjtpKyspCnsKIGNpbj4+YVtpXTsKfQpmb3IoaW50IGk9MDtpPG47aSsrKQp7CiAgaWYoYVtpXT5tYXgpCnsKICBtYXg9YVtpXTsKfQp9CmZvcihpbnQgaT0wO2k8bjtpKyspCnsKICBpZihhW2ldPG1pbikKewogIG1pbj1hW2ldOwp9Cn0KCWNvdXQ8PCBtYXgtbWluOwp9