import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    private static final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) {
        exec(args);
    }

    public static void exec(String[] args) {
        String str = readLineStandardInput();
        int N = Integer.parseInt(str);
        str = readLineStandardInput();
        String[] Astr = str.split(" ");
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        for(int i = 0; i < Astr.length; i++) {
            int tmp = Integer.parseInt(Astr[i]);
            min = min > tmp ? tmp : min;
            max = max < tmp ? tmp : max;
        }
        int res = max - min;
        System.out.println(res);
    }

    private static String readLineStandardInput() {
        String str;
        try {
            str = input.readLine();
        } catch(IOException e){
            str = null;
            System.out.println(e);
        }
        return str;
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    private static final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) {
        exec(args);
    }

    public static void exec(String[] args) {
        String str = readLineStandardInput();
        int N = Integer.parseInt(str);
        str = readLineStandardInput();
        String[] Astr = str.split(" ");
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        for(int i = 0; i < Astr.length; i++) {
            int tmp = Integer.parseInt(Astr[i]);
            min = min > tmp ? tmp : min;
            max = max < tmp ? tmp : max;
        }
        int res = max - min;
        System.out.println(res);
    }

    private static String readLineStandardInput() {
        String str;
        try {
            str = input.readLine();
        } catch(IOException e){
            str = null;
            System.out.println(e);
        }
        return str;
    }
} Main private static final BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) public static void main(String[] args) {
        exec(args);
    } main {
        exec(args);
    } exec(args) exec args String[] args args public static void exec(String[] args) {
        String str = readLineStandardInput();
        int N = Integer.parseInt(str);
        str = readLineStandardInput();
        String[] Astr = str.split(" ");
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        for(int i = 0; i < Astr.length; i++) {
            int tmp = Integer.parseInt(Astr[i]);
            min = min > tmp ? tmp : min;
            max = max < tmp ? tmp : max;
        }
        int res = max - min;
        System.out.println(res);
    } exec {
        String str = readLineStandardInput();
        int N = Integer.parseInt(str);
        str = readLineStandardInput();
        String[] Astr = str.split(" ");
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        for(int i = 0; i < Astr.length; i++) {
            int tmp = Integer.parseInt(Astr[i]);
            min = min > tmp ? tmp : min;
            max = max < tmp ? tmp : max;
        }
        int res = max - min;
        System.out.println(res);
    } String str = readLineStandardInput(); str readLineStandardInput() readLineStandardInput int N = Integer.parseInt(str); N Integer.parseInt(str) Integer.parseInt Integer str str = readLineStandardInput() str readLineStandardInput() readLineStandardInput String[] Astr = str.split(" "); Astr str.split(" ") str.split str " " int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE for(int i = 0; i < Astr.length; i++) {
            int tmp = Integer.parseInt(Astr[i]);
            min = min > tmp ? tmp : min;
            max = max < tmp ? tmp : max;
        } int i = 0; int i = 0; i 0 i < Astr.length i Astr.length Astr Astr.length i++ i++ i {
            int tmp = Integer.parseInt(Astr[i]);
            min = min > tmp ? tmp : min;
            max = max < tmp ? tmp : max;
        } {
            int tmp = Integer.parseInt(Astr[i]);
            min = min > tmp ? tmp : min;
            max = max < tmp ? tmp : max;
        } int tmp = Integer.parseInt(Astr[i]); tmp Integer.parseInt(Astr[i]) Integer.parseInt Integer Astr[i] Astr i min = min > tmp ? tmp : min min min > tmp ? tmp : min min > tmp min tmp tmp min max = max < tmp ? tmp : max max max < tmp ? tmp : max max < tmp max tmp tmp max int res = max - min; res max - min max min System.out.println(res) System.out.println System.out System System.out res String[] args args private static String readLineStandardInput() {
        String str;
        try {
            str = input.readLine();
        } catch(IOException e){
            str = null;
            System.out.println(e);
        }
        return str;
    } readLineStandardInput {
        String str;
        try {
            str = input.readLine();
        } catch(IOException e){
            str = null;
            System.out.println(e);
        }
        return str;
    } String str; str try {
            str = input.readLine();
        } catch(IOException e){
            str = null;
            System.out.println(e);
        } catch(IOException e){
            str = null;
            System.out.println(e);
        } IOException e {
            str = null;
            System.out.println(e);
        } str = null str null System.out.println(e) System.out.println System.out System System.out e {
            str = input.readLine();
        } str = input.readLine() str input.readLine() input.readLine input return str; str public class Main {
    private static final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) {
        exec(args);
    }

    public static void exec(String[] args) {
        String str = readLineStandardInput();
        int N = Integer.parseInt(str);
        str = readLineStandardInput();
        String[] Astr = str.split(" ");
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        for(int i = 0; i < Astr.length; i++) {
            int tmp = Integer.parseInt(Astr[i]);
            min = min > tmp ? tmp : min;
            max = max < tmp ? tmp : max;
        }
        int res = max - min;
        System.out.println(res);
    }

    private static String readLineStandardInput() {
        String str;
        try {
            str = input.readLine();
        } catch(IOException e){
            str = null;
            System.out.println(e);
        }
        return str;
    }
} public class Main {
    private static final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) {
        exec(args);
    }

    public static void exec(String[] args) {
        String str = readLineStandardInput();
        int N = Integer.parseInt(str);
        str = readLineStandardInput();
        String[] Astr = str.split(" ");
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        for(int i = 0; i < Astr.length; i++) {
            int tmp = Integer.parseInt(Astr[i]);
            min = min > tmp ? tmp : min;
            max = max < tmp ? tmp : max;
        }
        int res = max - min;
        System.out.println(res);
    }

    private static String readLineStandardInput() {
        String str;
        try {
            str = input.readLine();
        } catch(IOException e){
            str = null;
            System.out.println(e);
        }
        return str;
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    private static final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) {
        exec(args);
    }

    public static void exec(String[] args) {
        String str = readLineStandardInput();
        int N = Integer.parseInt(str);
        str = readLineStandardInput();
        String[] Astr = str.split(" ");
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        for(int i = 0; i < Astr.length; i++) {
            int tmp = Integer.parseInt(Astr[i]);
            min = min > tmp ? tmp : min;
            max = max < tmp ? tmp : max;
        }
        int res = max - min;
        System.out.println(res);
    }

    private static String readLineStandardInput() {
        String str;
        try {
            str = input.readLine();
        } catch(IOException e){
            str = null;
            System.out.println(e);
        }
        return str;
    }
}
