import java.util.*;

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

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

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

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

      	for (int i = 0; i < n; i++) {
          	int a = Integer.parseInt(sc.next());
        	if (i == 0) max = min = a;
          	if (max < a) max = a;
          	if (min > a) 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 = 0; max 0 int min = 0; min 0 for (int i = 0; i < n; i++) {
          	int a = Integer.parseInt(sc.next());
        	if (i == 0) max = min = a;
          	if (max < a) max = a;
          	if (min > a) min = a;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          	int a = Integer.parseInt(sc.next());
        	if (i == 0) max = min = a;
          	if (max < a) max = a;
          	if (min > a) min = a;
        } {
          	int a = Integer.parseInt(sc.next());
        	if (i == 0) max = min = a;
          	if (max < a) max = a;
          	if (min > a) min = a;
        } int a = Integer.parseInt(sc.next()); a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if (i == 0) max = min = a; i == 0 i 0 max = min = a max min = a min a if (max < a) max = a; max < a max a max = a max a if (min > a) min = a; min > a min a min = a 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 {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int n = Integer.parseInt(sc.next());
      	int max = 0;
      	int min = 0;

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