import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String no = sc.nextLine();
        String str = sc.nextLine();
        String[] strArraySub = str.split(" ");
        int[] box = new int[strArraySub.length];
        for(int i=0;i<strArraySub.length;i++){
            box[i]=Integer.parseInt(strArraySub[i]);
        }
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<box.length;i++){
            max=Math.max(max, box[i]);
        }

        for(int i=0;i<box.length;i++){
            min=Math.min(min, box[i]);
        }
        System.out.println(max-min);
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String no = sc.nextLine();
        String str = sc.nextLine();
        String[] strArraySub = str.split(" ");
        int[] box = new int[strArraySub.length];
        for(int i=0;i<strArraySub.length;i++){
            box[i]=Integer.parseInt(strArraySub[i]);
        }
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<box.length;i++){
            max=Math.max(max, box[i]);
        }

        for(int i=0;i<box.length;i++){
            min=Math.min(min, box[i]);
        }
        System.out.println(max-min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String no = sc.nextLine();
        String str = sc.nextLine();
        String[] strArraySub = str.split(" ");
        int[] box = new int[strArraySub.length];
        for(int i=0;i<strArraySub.length;i++){
            box[i]=Integer.parseInt(strArraySub[i]);
        }
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<box.length;i++){
            max=Math.max(max, box[i]);
        }

        for(int i=0;i<box.length;i++){
            min=Math.min(min, box[i]);
        }
        System.out.println(max-min);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String no = sc.nextLine();
        String str = sc.nextLine();
        String[] strArraySub = str.split(" ");
        int[] box = new int[strArraySub.length];
        for(int i=0;i<strArraySub.length;i++){
            box[i]=Integer.parseInt(strArraySub[i]);
        }
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<box.length;i++){
            max=Math.max(max, box[i]);
        }

        for(int i=0;i<box.length;i++){
            min=Math.min(min, box[i]);
        }
        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 String no = sc.nextLine(); no sc.nextLine() sc.nextLine sc String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String[] strArraySub = str.split(" "); strArraySub str.split(" ") str.split str " " int[] box = new int[strArraySub.length]; box new int[strArraySub.length] strArraySub.length strArraySub strArraySub.length for(int i=0;i<strArraySub.length;i++){
            box[i]=Integer.parseInt(strArraySub[i]);
        } int i=0; int i=0; i 0 i<strArraySub.length i strArraySub.length strArraySub strArraySub.length i++ i++ i {
            box[i]=Integer.parseInt(strArraySub[i]);
        } {
            box[i]=Integer.parseInt(strArraySub[i]);
        } box[i]=Integer.parseInt(strArraySub[i]) box[i] box i Integer.parseInt(strArraySub[i]) Integer.parseInt Integer strArraySub[i] strArraySub i int max=0; max 0 int min=Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<box.length;i++){
            max=Math.max(max, box[i]);
        } int i=0; int i=0; i 0 i<box.length i box.length box box.length i++ i++ i {
            max=Math.max(max, box[i]);
        } {
            max=Math.max(max, box[i]);
        } max=Math.max(max, box[i]) max Math.max(max, box[i]) Math.max Math max box[i] box i for(int i=0;i<box.length;i++){
            min=Math.min(min, box[i]);
        } int i=0; int i=0; i 0 i<box.length i box.length box box.length i++ i++ i {
            min=Math.min(min, box[i]);
        } {
            min=Math.min(min, box[i]);
        } min=Math.min(min, box[i]) min Math.min(min, box[i]) Math.min Math min box[i] box i System.out.println(max-min) System.out.println System.out System System.out max-min max min String[] args args
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String no = sc.nextLine();
        String str = sc.nextLine();
        String[] strArraySub = str.split(" ");
        int[] box = new int[strArraySub.length];
        for(int i=0;i<strArraySub.length;i++){
            box[i]=Integer.parseInt(strArraySub[i]);
        }
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<box.length;i++){
            max=Math.max(max, box[i]);
        }

        for(int i=0;i<box.length;i++){
            min=Math.min(min, box[i]);
        }
        System.out.println(max-min);
    }
}