import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int An[] = new int[N];
        int ans=0;
        //Anに値を取り込む
        for (int i = 0; i < N; i++) {
            An[i] = s.nextInt();
        }
        Arrays.sort(An);
        ans=An[N-1]-An[0];
        //ansを出力する
        System.out.print(ans);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int An[] = new int[N];
        int ans=0;
        //Anに値を取り込む
        for (int i = 0; i < N; i++) {
            An[i] = s.nextInt();
        }
        Arrays.sort(An);
        ans=An[N-1]-An[0];
        //ansを出力する
        System.out.print(ans);
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int An[] = new int[N];
        int ans=0;
        //Anに値を取り込む
        for (int i = 0; i < N; i++) {
            An[i] = s.nextInt();
        }
        Arrays.sort(An);
        ans=An[N-1]-An[0];
        //ansを出力する
        System.out.print(ans);
    } main {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int An[] = new int[N];
        int ans=0;
        //Anに値を取り込む
        for (int i = 0; i < N; i++) {
            An[i] = s.nextInt();
        }
        Arrays.sort(An);
        ans=An[N-1]-An[0];
        //ansを出力する
        System.out.print(ans);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int N = s.nextInt(); N s.nextInt() s.nextInt s int An[] = new int[N]; An new int[N] N int ans=0; ans 0 for (int i = 0; i < N; i++) {
            An[i] = s.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            An[i] = s.nextInt();
        } {
            An[i] = s.nextInt();
        } An[i] = s.nextInt() An[i] An i s.nextInt() s.nextInt s Arrays.sort(An) Arrays.sort Arrays An ans=An[N-1]-An[0] ans An[N-1]-An[0] An[N-1] An N-1 N 1 An[0] An 0 System.out.print(ans) System.out.print System.out System System.out ans String[] args args public class Main{
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int An[] = new int[N];
        int ans=0;
        //Anに値を取り込む
        for (int i = 0; i < N; i++) {
            An[i] = s.nextInt();
        }
        Arrays.sort(An);
        ans=An[N-1]-An[0];
        //ansを出力する
        System.out.print(ans);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int An[] = new int[N];
        int ans=0;
        //Anに値を取り込む
        for (int i = 0; i < N; i++) {
            An[i] = s.nextInt();
        }
        Arrays.sort(An);
        ans=An[N-1]-An[0];
        //ansを出力する
        System.out.print(ans);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int An[] = new int[N];
        int ans=0;
        //Anに値を取り込む
        for (int i = 0; i < N; i++) {
            An[i] = s.nextInt();
        }
        Arrays.sort(An);
        ans=An[N-1]-An[0];
        //ansを出力する
        System.out.print(ans);
    }
}
