import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int MAX=-1;
        int MIN=1000000007;
        for(int i=0;i<N;i++){
            int S=sc.nextInt();
            if(S>MAX) MAX=S;
            if(S<MIN) MIN=S;
        }
        
        System.out.println(MAX-MIN);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int MAX=-1;
        int MIN=1000000007;
        for(int i=0;i<N;i++){
            int S=sc.nextInt();
            if(S>MAX) MAX=S;
            if(S<MIN) MIN=S;
        }
        
        System.out.println(MAX-MIN);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int MAX=-1;
        int MIN=1000000007;
        for(int i=0;i<N;i++){
            int S=sc.nextInt();
            if(S>MAX) MAX=S;
            if(S<MIN) MIN=S;
        }
        
        System.out.println(MAX-MIN);
    } main {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int MAX=-1;
        int MIN=1000000007;
        for(int i=0;i<N;i++){
            int S=sc.nextInt();
            if(S>MAX) MAX=S;
            if(S<MIN) MIN=S;
        }
        
        System.out.println(MAX-MIN);
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int MAX=-1; MAX -1 1 int MIN=1000000007; MIN 1000000007 for(int i=0;i<N;i++){
            int S=sc.nextInt();
            if(S>MAX) MAX=S;
            if(S<MIN) MIN=S;
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            int S=sc.nextInt();
            if(S>MAX) MAX=S;
            if(S<MIN) MIN=S;
        } {
            int S=sc.nextInt();
            if(S>MAX) MAX=S;
            if(S<MIN) MIN=S;
        } int S=sc.nextInt(); S sc.nextInt() sc.nextInt sc if(S>MAX) MAX=S; S>MAX S MAX MAX=S MAX S if(S<MIN) MIN=S; S<MIN S MIN MIN=S MIN S System.out.println(MAX-MIN) System.out.println System.out System System.out MAX-MIN MAX MIN String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int MAX=-1;
        int MIN=1000000007;
        for(int i=0;i<N;i++){
            int S=sc.nextInt();
            if(S>MAX) MAX=S;
            if(S<MIN) MIN=S;
        }
        
        System.out.println(MAX-MIN);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int MAX=-1;
        int MIN=1000000007;
        for(int i=0;i<N;i++){
            int S=sc.nextInt();
            if(S>MAX) MAX=S;
            if(S<MIN) MIN=S;
        }
        
        System.out.println(MAX-MIN);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int MAX=-1;
        int MIN=1000000007;
        for(int i=0;i<N;i++){
            int S=sc.nextInt();
            if(S>MAX) MAX=S;
            if(S<MIN) MIN=S;
        }
        
        System.out.println(MAX-MIN);
    }
}
