import java.io.*;
import java.util.*;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int max = 0;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            int a = in.i();
            if (max < a) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        }
        System.out.println(max - min);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int max = 0;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            int a = in.i();
            if (max < a) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        }
        System.out.println(max - min);
    }
} Main static MyReader in = new MyReader(); in new MyReader() public static void main(String[] args) {
        int N = in.i();
        int max = 0;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            int a = in.i();
            if (max < a) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        }
        System.out.println(max - min);
    } main {
        int N = in.i();
        int max = 0;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            int a = in.i();
            if (max < a) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        }
        System.out.println(max - min);
    } int N = in.i(); N in.i() in.i in 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++) {
            int a = in.i();
            if (max < a) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int a = in.i();
            if (max < a) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        } {
            int a = in.i();
            if (max < a) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        } int a = in.i(); a in.i() in.i in if (max < a) {
                max = a;
            } max < a max a {
                max = a;
            } max = a max a if (a < min) {
                min = a;
            } a < min a min {
                min = a;
            } min = a min a System.out.println(max - min) System.out.println System.out System System.out max - min max min String[] args args class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
} MyReader char[] cbuf = new char[1024]; cbuf new char[1024] 1024 int head = 0; head 0 int tail = 0; tail 0 MyReader() {
        super(new InputStreamReader(System.in));
    } MyReader {
        super(new InputStreamReader(System.in));
    } super(new InputStreamReader(System.in)) super new InputStreamReader(System.in) char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    } next {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    } if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        } head == tail head tail {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        } try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                tail = super.read(cbuf, 0, cbuf.length);
            } tail = super.read(cbuf, 0, cbuf.length) tail super.read(cbuf, 0, cbuf.length) super.read super cbuf 0 cbuf.length cbuf cbuf.length head = 0 head 0 return cbuf[head++]; cbuf[head++] cbuf head++ head int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    } i {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    } int k = next() - '0'; k next() - '0' next() next '0' boolean minus = k == -3; minus k == -3 k -3 3 int n = minus ? 0 : k; n minus ? 0 : k minus 0 k while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k; 0 <= (k = next() - '0') && k <= 9 0 <= (k = next() - '0') 0 (k = next() - '0') k next() - '0' next() next '0' k <= 9 k 9 n = 10 * n + k n 10 * n + k 10 * n 10 n k return minus ? -n : n; minus ? -n : n minus -n n n int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    } ii {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    } int[] a = new int[N]; a new int[N] N for (int j = 0; j < a.length; j++) a[j] = i(); int j = 0; int j = 0; j 0 j < a.length j a.length a a.length j++ j++ j a[j] = i(); a[j] = i() a[j] a j i() i return a; a final int N N long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    } l {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    } int k = next() - '0'; k next() - '0' next() next '0' boolean minus = k == -3; minus k == -3 k -3 3 long n = minus ? 0 : k; n minus ? 0 : k minus 0 k while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k; 0 <= (k = next() - '0') && k <= 9 0 <= (k = next() - '0') 0 (k = next() - '0') k next() - '0' next() next '0' k <= 9 k 9 n = 10 * n + k n 10 * n + k 10 * n 10 n k return minus ? -n : n; minus ? -n : n minus -n n n char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    } s {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    } char[] s = new char[N]; s new char[N] N for (int i = 0; i < N; i++) {
            s[i] = next();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            s[i] = next();
        } {
            s[i] = next();
        } s[i] = next() s[i] s i next() next next() next return s; s final int N N public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    } read {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    } int i; i char c; c for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c; i = 0; i = 0 i 0 (c = next()) != ' ' && c != '\n' (c = next()) != ' ' (c = next()) c next() next ' ' c != '\n' c '\n' i++ i++ i cbuf[i] = c; cbuf[i] = c cbuf[i] cbuf i c return i; i char[] cbuf cbuf public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    } readLine {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    } try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        } catch (IOException e) {
            return null;
        } IOException e {
            return null;
        } return null; null {
            return super.readLine();
        } return super.readLine(); super.readLine() super.readLine super BufferedReader public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int max = 0;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            int a = in.i();
            if (max < a) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        }
        System.out.println(max - min);
    }
} public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int max = 0;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            int a = in.i();
            if (max < a) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        }
        System.out.println(max - min);
    }
} Main
import java.io.*;
import java.util.*;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int max = 0;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            int a = in.i();
            if (max < a) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        }
        System.out.println(max - min);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}
