import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        int min = arr[0];
        int max = arr[0];

        for(int j = 0; j < N; j++) {
            if(min >= arr[j]) {
                min = arr[j];
            }
            if(max <= arr[j]) {
                max = arr[j];
            }
        }
        System.out.println(max - min);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        int min = arr[0];
        int max = arr[0];

        for(int j = 0; j < N; j++) {
            if(min >= arr[j]) {
                min = arr[j];
            }
            if(max <= arr[j]) {
                max = arr[j];
            }
        }
        System.out.println(max - min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        int min = arr[0];
        int max = arr[0];

        for(int j = 0; j < N; j++) {
            if(min >= arr[j]) {
                min = arr[j];
            }
            if(max <= arr[j]) {
                max = arr[j];
            }
        }
        System.out.println(max - min);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        int min = arr[0];
        int max = arr[0];

        for(int j = 0; j < N; j++) {
            if(min >= arr[j]) {
                min = arr[j];
            }
            if(max <= arr[j]) {
                max = arr[j];
            }
        }
        System.out.println(max - min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] arr = new int[N]; arr new int[N] N for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            arr[i] = sc.nextInt();
        } {
            arr[i] = sc.nextInt();
        } arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc int min = arr[0]; min arr[0] arr 0 int max = arr[0]; max arr[0] arr 0 for(int j = 0; j < N; j++) {
            if(min >= arr[j]) {
                min = arr[j];
            }
            if(max <= arr[j]) {
                max = arr[j];
            }
        } int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
            if(min >= arr[j]) {
                min = arr[j];
            }
            if(max <= arr[j]) {
                max = arr[j];
            }
        } {
            if(min >= arr[j]) {
                min = arr[j];
            }
            if(max <= arr[j]) {
                max = arr[j];
            }
        } if(min >= arr[j]) {
                min = arr[j];
            } min >= arr[j] min arr[j] arr j {
                min = arr[j];
            } min = arr[j] min arr[j] arr j if(max <= arr[j]) {
                max = arr[j];
            } max <= arr[j] max arr[j] arr j {
                max = arr[j];
            } max = arr[j] max arr[j] arr j 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 = sc.nextInt();
        int[] arr = new int[N];
        for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        int min = arr[0];
        int max = arr[0];

        for(int j = 0; j < N; j++) {
            if(min >= arr[j]) {
                min = arr[j];
            }
            if(max <= arr[j]) {
                max = arr[j];
            }
        }
        System.out.println(max - min);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        int min = arr[0];
        int max = arr[0];

        for(int j = 0; j < N; j++) {
            if(min >= arr[j]) {
                min = arr[j];
            }
            if(max <= arr[j]) {
                max = arr[j];
            }
        }
        System.out.println(max - min);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        int min = arr[0];
        int max = arr[0];

        for(int j = 0; j < N; j++) {
            if(min >= arr[j]) {
                min = arr[j];
            }
            if(max <= arr[j]) {
                max = arr[j];
            }
        }
        System.out.println(max - min);
    }
}
