import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       int n = Integer.parseInt(sc.next());
       int[] num = new int[n];
       for(int i = 0; i < n; i++){
           num[i] = Integer.parseInt(sc.next());
       }
       Arrays.sort(num);
       System.out.println(num[n-1]-num[0]);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       int n = Integer.parseInt(sc.next());
       int[] num = new int[n];
       for(int i = 0; i < n; i++){
           num[i] = Integer.parseInt(sc.next());
       }
       Arrays.sort(num);
       System.out.println(num[n-1]-num[0]);
    }
} Main public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       int n = Integer.parseInt(sc.next());
       int[] num = new int[n];
       for(int i = 0; i < n; i++){
           num[i] = Integer.parseInt(sc.next());
       }
       Arrays.sort(num);
       System.out.println(num[n-1]-num[0]);
    } main {
       Scanner sc = new Scanner(System.in);
       int n = Integer.parseInt(sc.next());
       int[] num = new int[n];
       for(int i = 0; i < n; i++){
           num[i] = Integer.parseInt(sc.next());
       }
       Arrays.sort(num);
       System.out.println(num[n-1]-num[0]);
    } 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[] num = new int[n]; num new int[n] n for(int i = 0; i < n; i++){
           num[i] = Integer.parseInt(sc.next());
       } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
           num[i] = Integer.parseInt(sc.next());
       } {
           num[i] = Integer.parseInt(sc.next());
       } num[i] = Integer.parseInt(sc.next()) num[i] num i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Arrays.sort(num) Arrays.sort Arrays num System.out.println(num[n-1]-num[0]) System.out.println System.out System System.out num[n-1]-num[0] num[n-1] num n-1 n 1 num[0] num 0 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       int n = Integer.parseInt(sc.next());
       int[] num = new int[n];
       for(int i = 0; i < n; i++){
           num[i] = Integer.parseInt(sc.next());
       }
       Arrays.sort(num);
       System.out.println(num[n-1]-num[0]);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       int n = Integer.parseInt(sc.next());
       int[] num = new int[n];
       for(int i = 0; i < n; i++){
           num[i] = Integer.parseInt(sc.next());
       }
       Arrays.sort(num);
       System.out.println(num[n-1]-num[0]);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       int n = Integer.parseInt(sc.next());
       int[] num = new int[n];
       for(int i = 0; i < n; i++){
           num[i] = Integer.parseInt(sc.next());
       }
       Arrays.sort(num);
       System.out.println(num[n-1]-num[0]);
    }
}