import java.util.*;

class Main {
  	static final int INF = Integer.MAX_VALUE;
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int n = Integer.parseInt(sc.next());
      	int max = -1;
      	int min = INF;

      	for (int i = 0; i < n; i++) {
          	int a = Integer.parseInt(sc.next());
          	max = Math.max(max, a);
          	min = Math.min(min, a);
        }
      	System.out.println(max - min);
    }
} import java.util.*; util.* java class Main {
  	static final int INF = Integer.MAX_VALUE;
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int n = Integer.parseInt(sc.next());
      	int max = -1;
      	int min = INF;

      	for (int i = 0; i < n; i++) {
          	int a = Integer.parseInt(sc.next());
          	max = Math.max(max, a);
          	min = Math.min(min, a);
        }
      	System.out.println(max - min);
    }
} Main static final int INF = Integer.MAX_VALUE; INF Integer.MAX_VALUE Integer Integer.MAX_VALUE public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int n = Integer.parseInt(sc.next());
      	int max = -1;
      	int min = INF;

      	for (int i = 0; i < n; i++) {
          	int a = Integer.parseInt(sc.next());
          	max = Math.max(max, a);
          	min = Math.min(min, a);
        }
      	System.out.println(max - min);
    } main {
    	Scanner sc = new Scanner(System.in);
      	int n = Integer.parseInt(sc.next());
      	int max = -1;
      	int min = INF;

      	for (int i = 0; i < n; i++) {
          	int a = Integer.parseInt(sc.next());
          	max = Math.max(max, a);
          	min = Math.min(min, a);
        }
      	System.out.println(max - min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int max = -1; max -1 1 int min = INF; min INF for (int i = 0; i < n; i++) {
          	int a = Integer.parseInt(sc.next());
          	max = Math.max(max, a);
          	min = Math.min(min, a);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          	int a = Integer.parseInt(sc.next());
          	max = Math.max(max, a);
          	min = Math.min(min, a);
        } {
          	int a = Integer.parseInt(sc.next());
          	max = Math.max(max, a);
          	min = Math.min(min, a);
        } int a = Integer.parseInt(sc.next()); a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc max = Math.max(max, a) max Math.max(max, a) Math.max Math max a min = Math.min(min, a) min Math.min(min, a) Math.min Math min a System.out.println(max - min) System.out.println System.out System System.out max - min max min String[] args args
import java.util.*;

class Main {
  	static final int INF = Integer.MAX_VALUE;
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int n = Integer.parseInt(sc.next());
      	int max = -1;
      	int min = INF;

      	for (int i = 0; i < n; i++) {
          	int a = Integer.parseInt(sc.next());
          	max = Math.max(max, a);
          	min = Math.min(min, a);
        }
      	System.out.println(max - min);
    }
}