import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long[] a = new long[N];
        a[0] = Long.parseLong(sc.next());
        long max = a[0];
        long min = a[0];
        for(int i=1; i<N; i++) {
            a[i] = Long.parseLong(sc.next());
            if(max < a[i]) max = a[i];
            if(min > a[i]) min = a[i];
        }
        System.out.println(max-min);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long[] a = new long[N];
        a[0] = Long.parseLong(sc.next());
        long max = a[0];
        long min = a[0];
        for(int i=1; i<N; i++) {
            a[i] = Long.parseLong(sc.next());
            if(max < a[i]) max = a[i];
            if(min > a[i]) min = a[i];
        }
        System.out.println(max-min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long[] a = new long[N];
        a[0] = Long.parseLong(sc.next());
        long max = a[0];
        long min = a[0];
        for(int i=1; i<N; i++) {
            a[i] = Long.parseLong(sc.next());
            if(max < a[i]) max = a[i];
            if(min > a[i]) min = a[i];
        }
        System.out.println(max-min);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long[] a = new long[N];
        a[0] = Long.parseLong(sc.next());
        long max = a[0];
        long min = a[0];
        for(int i=1; i<N; i++) {
            a[i] = Long.parseLong(sc.next());
            if(max < a[i]) max = a[i];
            if(min > a[i]) min = a[i];
        }
        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 long[] a = new long[N]; a new long[N] N a[0] = Long.parseLong(sc.next()) a[0] a 0 Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc long max = a[0]; max a[0] a 0 long min = a[0]; min a[0] a 0 for(int i=1; i<N; i++) {
            a[i] = Long.parseLong(sc.next());
            if(max < a[i]) max = a[i];
            if(min > a[i]) min = a[i];
        } int i=1; int i=1; i 1 i<N i N i++ i++ i {
            a[i] = Long.parseLong(sc.next());
            if(max < a[i]) max = a[i];
            if(min > a[i]) min = a[i];
        } {
            a[i] = Long.parseLong(sc.next());
            if(max < a[i]) max = a[i];
            if(min > a[i]) min = a[i];
        } a[i] = Long.parseLong(sc.next()) a[i] a i Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc if(max < a[i]) max = a[i]; max < a[i] max a[i] a i max = a[i] max a[i] a i if(min > a[i]) min = a[i]; min > a[i] min a[i] a i min = a[i] min a[i] a i 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) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long[] a = new long[N];
        a[0] = Long.parseLong(sc.next());
        long max = a[0];
        long min = a[0];
        for(int i=1; i<N; i++) {
            a[i] = Long.parseLong(sc.next());
            if(max < a[i]) max = a[i];
            if(min > a[i]) min = a[i];
        }
        System.out.println(max-min);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long[] a = new long[N];
        a[0] = Long.parseLong(sc.next());
        long max = a[0];
        long min = a[0];
        for(int i=1; i<N; i++) {
            a[i] = Long.parseLong(sc.next());
            if(max < a[i]) max = a[i];
            if(min > a[i]) min = a[i];
        }
        System.out.println(max-min);
    }
} Main
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long[] a = new long[N];
        a[0] = Long.parseLong(sc.next());
        long max = a[0];
        long min = a[0];
        for(int i=1; i<N; i++) {
            a[i] = Long.parseLong(sc.next());
            if(max < a[i]) max = a[i];
            if(min > a[i]) min = a[i];
        }
        System.out.println(max-min);
    }
}