import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int minval = Integer.MAX_VALUE;
        int maxval = Integer.MIN_VALUE;
        for (int i=0; i<n; i++) {
            int x = sc.nextInt();
            minval = Math.min(minval, x);
            maxval = Math.max(maxval, x);
        }
        System.out.println(maxval-minval);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int minval = Integer.MAX_VALUE;
        int maxval = Integer.MIN_VALUE;
        for (int i=0; i<n; i++) {
            int x = sc.nextInt();
            minval = Math.min(minval, x);
            maxval = Math.max(maxval, x);
        }
        System.out.println(maxval-minval);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int minval = Integer.MAX_VALUE;
        int maxval = Integer.MIN_VALUE;
        for (int i=0; i<n; i++) {
            int x = sc.nextInt();
            minval = Math.min(minval, x);
            maxval = Math.max(maxval, x);
        }
        System.out.println(maxval-minval);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int minval = Integer.MAX_VALUE;
        int maxval = Integer.MIN_VALUE;
        for (int i=0; i<n; i++) {
            int x = sc.nextInt();
            minval = Math.min(minval, x);
            maxval = Math.max(maxval, x);
        }
        System.out.println(maxval-minval);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int minval = Integer.MAX_VALUE; minval Integer.MAX_VALUE Integer Integer.MAX_VALUE int maxval = Integer.MIN_VALUE; maxval Integer.MIN_VALUE Integer Integer.MIN_VALUE for (int i=0; i<n; i++) {
            int x = sc.nextInt();
            minval = Math.min(minval, x);
            maxval = Math.max(maxval, x);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            int x = sc.nextInt();
            minval = Math.min(minval, x);
            maxval = Math.max(maxval, x);
        } {
            int x = sc.nextInt();
            minval = Math.min(minval, x);
            maxval = Math.max(maxval, x);
        } int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc minval = Math.min(minval, x) minval Math.min(minval, x) Math.min Math minval x maxval = Math.max(maxval, x) maxval Math.max(maxval, x) Math.max Math maxval x System.out.println(maxval-minval) System.out.println System.out System System.out maxval-minval maxval minval String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int minval = Integer.MAX_VALUE;
        int maxval = Integer.MIN_VALUE;
        for (int i=0; i<n; i++) {
            int x = sc.nextInt();
            minval = Math.min(minval, x);
            maxval = Math.max(maxval, x);
        }
        System.out.println(maxval-minval);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int minval = Integer.MAX_VALUE;
        int maxval = Integer.MIN_VALUE;
        for (int i=0; i<n; i++) {
            int x = sc.nextInt();
            minval = Math.min(minval, x);
            maxval = Math.max(maxval, x);
        }
        System.out.println(maxval-minval);
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int minval = Integer.MAX_VALUE;
        int maxval = Integer.MIN_VALUE;
        for (int i=0; i<n; i++) {
            int x = sc.nextInt();
            minval = Math.min(minval, x);
            maxval = Math.max(maxval, x);
        }
        System.out.println(maxval-minval);
    }
}