import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)){

            int n = sc.nextInt();
			int[] R = new int[n];

			for (int i = 0; i < n; i++) {
				R[i] = sc.nextInt();
            }

            System.out.println(getB(R));
		}
    }

    public static int getB(int[] R){
        int minv = R[0];
        int maxv = R[0];
        for (int i = 1; i < R.length; i++) {
            if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            }
        }
        return maxv - minv;
    }
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)){

            int n = sc.nextInt();
			int[] R = new int[n];

			for (int i = 0; i < n; i++) {
				R[i] = sc.nextInt();
            }

            System.out.println(getB(R));
		}
    }

    public static int getB(int[] R){
        int minv = R[0];
        int maxv = R[0];
        for (int i = 1; i < R.length; i++) {
            if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            }
        }
        return maxv - minv;
    }
} Main public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)){

            int n = sc.nextInt();
			int[] R = new int[n];

			for (int i = 0; i < n; i++) {
				R[i] = sc.nextInt();
            }

            System.out.println(getB(R));
		}
    } main {

		try (Scanner sc = new Scanner(System.in)){

            int n = sc.nextInt();
			int[] R = new int[n];

			for (int i = 0; i < n; i++) {
				R[i] = sc.nextInt();
            }

            System.out.println(getB(R));
		}
    } try (Scanner sc = new Scanner(System.in)){

            int n = sc.nextInt();
			int[] R = new int[n];

			for (int i = 0; i < n; i++) {
				R[i] = sc.nextInt();
            }

            System.out.println(getB(R));
		} {

            int n = sc.nextInt();
			int[] R = new int[n];

			for (int i = 0; i < n; i++) {
				R[i] = sc.nextInt();
            }

            System.out.println(getB(R));
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] R = new int[n]; R new int[n] n for (int i = 0; i < n; i++) {
				R[i] = sc.nextInt();
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				R[i] = sc.nextInt();
            } {
				R[i] = sc.nextInt();
            } R[i] = sc.nextInt() R[i] R i sc.nextInt() sc.nextInt sc System.out.println(getB(R)) System.out.println System.out System System.out getB(R) getB R String[] args args public static int getB(int[] R){
        int minv = R[0];
        int maxv = R[0];
        for (int i = 1; i < R.length; i++) {
            if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            }
        }
        return maxv - minv;
    } getB {
        int minv = R[0];
        int maxv = R[0];
        for (int i = 1; i < R.length; i++) {
            if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            }
        }
        return maxv - minv;
    } int minv = R[0]; minv R[0] R 0 int maxv = R[0]; maxv R[0] R 0 for (int i = 1; i < R.length; i++) {
            if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            }
        } int i = 1; int i = 1; i 1 i < R.length i R.length R R.length i++ i++ i {
            if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            }
        } {
            if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            }
        } if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            } R[i] > maxv R[i] R i maxv {
                maxv = R[i];
            } maxv = R[i] maxv R[i] R i if (R[i] < minv){
                minv = R[i];
            } R[i] < minv R[i] R i minv {
                minv = R[i];
            } minv = R[i] minv R[i] R i return maxv - minv; maxv - minv maxv minv int[] R R public class Main {
	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)){

            int n = sc.nextInt();
			int[] R = new int[n];

			for (int i = 0; i < n; i++) {
				R[i] = sc.nextInt();
            }

            System.out.println(getB(R));
		}
    }

    public static int getB(int[] R){
        int minv = R[0];
        int maxv = R[0];
        for (int i = 1; i < R.length; i++) {
            if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            }
        }
        return maxv - minv;
    }
} public class Main {
	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)){

            int n = sc.nextInt();
			int[] R = new int[n];

			for (int i = 0; i < n; i++) {
				R[i] = sc.nextInt();
            }

            System.out.println(getB(R));
		}
    }

    public static int getB(int[] R){
        int minv = R[0];
        int maxv = R[0];
        for (int i = 1; i < R.length; i++) {
            if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            }
        }
        return maxv - minv;
    }
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)){

            int n = sc.nextInt();
			int[] R = new int[n];

			for (int i = 0; i < n; i++) {
				R[i] = sc.nextInt();
            }

            System.out.println(getB(R));
		}
    }

    public static int getB(int[] R){
        int minv = R[0];
        int maxv = R[0];
        for (int i = 1; i < R.length; i++) {
            if (R[i] > maxv) {
                maxv = R[i];
            } else if (R[i] < minv){
                minv = R[i];
            }
        }
        return maxv - minv;
    }
}