import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] as = br.readLine().split(" ");
        int max = -1;
        int min = 1000000005;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(as[i]);
            if (max < a) max = a;
            if (min > a) min = a;
        }
        System.out.println(max-min);
    }
} import java.util.*; util.* java import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] as = br.readLine().split(" ");
        int max = -1;
        int min = 1000000005;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(as[i]);
            if (max < a) max = a;
            if (min > a) min = a;
        }
        System.out.println(max-min);
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] as = br.readLine().split(" ");
        int max = -1;
        int min = 1000000005;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(as[i]);
            if (max < a) max = a;
            if (min > a) min = a;
        }
        System.out.println(max-min);
    } main {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] as = br.readLine().split(" ");
        int max = -1;
        int min = 1000000005;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(as[i]);
            if (max < a) max = a;
            if (min > a) min = a;
        }
        System.out.println(max-min);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] as = br.readLine().split(" "); as br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int max = -1; max -1 1 int min = 1000000005; min 1000000005 for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(as[i]);
            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(as[i]);
            if (max < a) max = a;
            if (min > a) min = a;
        } {
            int a = Integer.parseInt(as[i]);
            if (max < a) max = a;
            if (min > a) min = a;
        } int a = Integer.parseInt(as[i]); a Integer.parseInt(as[i]) Integer.parseInt Integer as[i] as i 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 public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] as = br.readLine().split(" ");
        int max = -1;
        int min = 1000000005;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(as[i]);
            if (max < a) max = a;
            if (min > a) min = a;
        }
        System.out.println(max-min);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] as = br.readLine().split(" ");
        int max = -1;
        int min = 1000000005;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(as[i]);
            if (max < a) max = a;
            if (min > a) min = a;
        }
        System.out.println(max-min);
    }
} Main
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] as = br.readLine().split(" ");
        int max = -1;
        int min = 1000000005;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(as[i]);
            if (max < a) max = a;
            if (min > a) min = a;
        }
        System.out.println(max-min);
    }
}
