import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        // long K = sc.nextLong();
        // int[] A = new int[N];
        int max = -1;
        int min = 1000000001;
        for(int i=0; i<N; i++){
            int a = sc.nextInt();
            if(a>max){
                max = a;
            }
            if(a<min){
                min = a;
            }
        }

        System.out.println(max - min);
        
        sc.close();

    }
}       import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        // long K = sc.nextLong();
        // int[] A = new int[N];
        int max = -1;
        int min = 1000000001;
        for(int i=0; i<N; i++){
            int a = sc.nextInt();
            if(a>max){
                max = a;
            }
            if(a<min){
                min = a;
            }
        }

        System.out.println(max - min);
        
        sc.close();

    }
} Main public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        // long K = sc.nextLong();
        // int[] A = new int[N];
        int max = -1;
        int min = 1000000001;
        for(int i=0; i<N; i++){
            int a = sc.nextInt();
            if(a>max){
                max = a;
            }
            if(a<min){
                min = a;
            }
        }

        System.out.println(max - min);
        
        sc.close();

    } solve {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        // long K = sc.nextLong();
        // int[] A = new int[N];
        int max = -1;
        int min = 1000000001;
        for(int i=0; i<N; i++){
            int a = sc.nextInt();
            if(a>max){
                max = a;
            }
            if(a<min){
                min = a;
            }
        }

        System.out.println(max - min);
        
        sc.close();

    } 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 = 1000000001; min 1000000001 for(int i=0; i<N; i++){
            int a = sc.nextInt();
            if(a>max){
                max = a;
            }
            if(a<min){
                min = a;
            }
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            int a = sc.nextInt();
            if(a>max){
                max = a;
            }
            if(a<min){
                min = a;
            }
        } {
            int a = sc.nextInt();
            if(a>max){
                max = a;
            }
            if(a<min){
                min = a;
            }
        } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc if(a>max){
                max = a;
            } a>max a max {
                max = a;
            } max = a max a if(a<min){
                min = a;
            } a<min a min {
                min = a;
            } min = a min a System.out.println(max - min) System.out.println System.out System System.out max - min max min sc.close() sc.close sc public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        // long K = sc.nextLong();
        // int[] A = new int[N];
        int max = -1;
        int min = 1000000001;
        for(int i=0; i<N; i++){
            int a = sc.nextInt();
            if(a>max){
                max = a;
            }
            if(a<min){
                min = a;
            }
        }

        System.out.println(max - min);
        
        sc.close();

    }
} public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        // long K = sc.nextLong();
        // int[] A = new int[N];
        int max = -1;
        int min = 1000000001;
        for(int i=0; i<N; i++){
            int a = sc.nextInt();
            if(a>max){
                max = a;
            }
            if(a<min){
                min = a;
            }
        }

        System.out.println(max - min);
        
        sc.close();

    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        // long K = sc.nextLong();
        // int[] A = new int[N];
        int max = -1;
        int min = 1000000001;
        for(int i=0; i<N; i++){
            int a = sc.nextInt();
            if(a>max){
                max = a;
            }
            if(a<min){
                min = a;
            }
        }

        System.out.println(max - min);
        
        sc.close();

    }
}      