import java.util.Arrays;
import java.util.Scanner;

/**
 * @author varun on 7/1/2018
 * @project CompetitiveProgramming
 */
public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; ++i) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        System.out.println(arr[N-1] - arr[0]);
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; ++i) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        System.out.println(arr[N-1] - arr[0]);
    }
} Main public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; ++i) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        System.out.println(arr[N-1] - arr[0]);
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; ++i) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        System.out.println(arr[N-1] - arr[0]);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int[] arr = new int[N]; arr new int[N] N for (int i = 0; i < N; ++i) arr[i] = scanner.nextInt(); int i = 0; int i = 0; i 0 i < N i N ++i ++i i arr[i] = scanner.nextInt(); arr[i] = scanner.nextInt() arr[i] arr i scanner.nextInt() scanner.nextInt scanner Arrays.sort(arr) Arrays.sort Arrays arr System.out.println(arr[N-1] - arr[0]) System.out.println System.out System System.out arr[N-1] - arr[0] arr[N-1] arr N-1 N 1 arr[0] arr 0 String args[] args public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; ++i) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        System.out.println(arr[N-1] - arr[0]);
    }
} public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; ++i) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        System.out.println(arr[N-1] - arr[0]);
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author varun on 7/1/2018
 * @project CompetitiveProgramming
 */
public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; ++i) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        System.out.println(arr[N-1] - arr[0]);
    }
}
