import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = 0;
        N = scanner.nextInt();
        int[] val= new int[N];
       for(int x=0; x<N; x++)val[x]=scanner.nextInt();
        Arrays.sort(val);
        System.out.println(val[N-1]-val[0]);
    }

} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = 0;
        N = scanner.nextInt();
        int[] val= new int[N];
       for(int x=0; x<N; x++)val[x]=scanner.nextInt();
        Arrays.sort(val);
        System.out.println(val[N-1]-val[0]);
    }

} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = 0;
        N = scanner.nextInt();
        int[] val= new int[N];
       for(int x=0; x<N; x++)val[x]=scanner.nextInt();
        Arrays.sort(val);
        System.out.println(val[N-1]-val[0]);
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = 0;
        N = scanner.nextInt();
        int[] val= new int[N];
       for(int x=0; x<N; x++)val[x]=scanner.nextInt();
        Arrays.sort(val);
        System.out.println(val[N-1]-val[0]);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = 0; N 0 N = scanner.nextInt() N scanner.nextInt() scanner.nextInt scanner int[] val= new int[N]; val new int[N] N for(int x=0; x<N; x++)val[x]=scanner.nextInt(); int x=0; int x=0; x 0 x<N x N x++ x++ x val[x]=scanner.nextInt(); val[x]=scanner.nextInt() val[x] val x scanner.nextInt() scanner.nextInt scanner Arrays.sort(val) Arrays.sort Arrays val System.out.println(val[N-1]-val[0]) System.out.println System.out System System.out val[N-1]-val[0] val[N-1] val N-1 N 1 val[0] val 0 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = 0;
        N = scanner.nextInt();
        int[] val= new int[N];
       for(int x=0; x<N; x++)val[x]=scanner.nextInt();
        Arrays.sort(val);
        System.out.println(val[N-1]-val[0]);
    }

} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = 0;
        N = scanner.nextInt();
        int[] val= new int[N];
       for(int x=0; x<N; x++)val[x]=scanner.nextInt();
        Arrays.sort(val);
        System.out.println(val[N-1]-val[0]);
    }

} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = 0;
        N = scanner.nextInt();
        int[] val= new int[N];
       for(int x=0; x<N; x++)val[x]=scanner.nextInt();
        Arrays.sort(val);
        System.out.println(val[N-1]-val[0]);
    }

}
