import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] ar=new int[n];
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<n;i++){
            ar[i]=sc.nextInt();
            max=Math.max(ar[i], max);
            min=Math.min(ar[i], min);
        }
        double b=max-min;
        int c=(int)Math.abs(b);
        System.out.println(c);
    }    
} 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[] ar=new int[n];
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<n;i++){
            ar[i]=sc.nextInt();
            max=Math.max(ar[i], max);
            min=Math.min(ar[i], min);
        }
        double b=max-min;
        int c=(int)Math.abs(b);
        System.out.println(c);
    }    
} Main public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] ar=new int[n];
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<n;i++){
            ar[i]=sc.nextInt();
            max=Math.max(ar[i], max);
            min=Math.min(ar[i], min);
        }
        double b=max-min;
        int c=(int)Math.abs(b);
        System.out.println(c);
    } main {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] ar=new int[n];
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<n;i++){
            ar[i]=sc.nextInt();
            max=Math.max(ar[i], max);
            min=Math.min(ar[i], min);
        }
        double b=max-min;
        int c=(int)Math.abs(b);
        System.out.println(c);
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] ar=new int[n]; ar new int[n] n int max=0; max 0 int min=Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<n;i++){
            ar[i]=sc.nextInt();
            max=Math.max(ar[i], max);
            min=Math.min(ar[i], min);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            ar[i]=sc.nextInt();
            max=Math.max(ar[i], max);
            min=Math.min(ar[i], min);
        } {
            ar[i]=sc.nextInt();
            max=Math.max(ar[i], max);
            min=Math.min(ar[i], min);
        } ar[i]=sc.nextInt() ar[i] ar i sc.nextInt() sc.nextInt sc max=Math.max(ar[i], max) max Math.max(ar[i], max) Math.max Math ar[i] ar i max min=Math.min(ar[i], min) min Math.min(ar[i], min) Math.min Math ar[i] ar i min double b=max-min; b max-min max min int c=(int)Math.abs(b); c (int)Math.abs(b) Math.abs Math b System.out.println(c) System.out.println System.out System System.out c String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] ar=new int[n];
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<n;i++){
            ar[i]=sc.nextInt();
            max=Math.max(ar[i], max);
            min=Math.min(ar[i], min);
        }
        double b=max-min;
        int c=(int)Math.abs(b);
        System.out.println(c);
    }    
} public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] ar=new int[n];
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<n;i++){
            ar[i]=sc.nextInt();
            max=Math.max(ar[i], max);
            min=Math.min(ar[i], min);
        }
        double b=max-min;
        int c=(int)Math.abs(b);
        System.out.println(c);
    }    
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] ar=new int[n];
        int max=0;
        int min=Integer.MAX_VALUE;
        for(int i=0;i<n;i++){
            ar[i]=sc.nextInt();
            max=Math.max(ar[i], max);
            min=Math.min(ar[i], min);
        }
        double b=max-min;
        int c=(int)Math.abs(b);
        System.out.println(c);
    }    
}