import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int [N];
        for (int i = 0; i < N; ++i) {
                A[i] = sc.nextInt();
        }
        
        int max = A[0];
        int min = A[0];
        for(int i = 1; i < N; ++i) {
                if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[i];
                }
        }

        System.out.println(max- min);
	}
} 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[] A = new int [N];
        for (int i = 0; i < N; ++i) {
                A[i] = sc.nextInt();
        }
        
        int max = A[0];
        int min = A[0];
        for(int i = 1; i < N; ++i) {
                if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[i];
                }
        }

        System.out.println(max- min);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int [N];
        for (int i = 0; i < N; ++i) {
                A[i] = sc.nextInt();
        }
        
        int max = A[0];
        int min = A[0];
        for(int i = 1; i < N; ++i) {
                if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[i];
                }
        }

        System.out.println(max- min);
	} main {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int [N];
        for (int i = 0; i < N; ++i) {
                A[i] = sc.nextInt();
        }
        
        int max = A[0];
        int min = A[0];
        for(int i = 1; i < N; ++i) {
                if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[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 int[] A = new int [N]; A new int [N] N for (int i = 0; i < N; ++i) {
                A[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N ++i ++i i {
                A[i] = sc.nextInt();
        } {
                A[i] = sc.nextInt();
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int max = A[0]; max A[0] A 0 int min = A[0]; min A[0] A 0 for(int i = 1; i < N; ++i) {
                if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[i];
                }
        } int i = 1; int i = 1; i 1 i < N i N ++i ++i i {
                if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[i];
                }
        } {
                if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[i];
                }
        } if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[i];
                } A[i] > max A[i] A i max {
                        max = A[i];
                } max = A[i] max A[i] A i if (A[i] < min) {
                        min = A[i];
                } A[i] < min A[i] A i min {
                        min = A[i];
                } min = A[i] min A[i] A i System.out.println(max- min) System.out.println System.out System System.out max- min max min String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int [N];
        for (int i = 0; i < N; ++i) {
                A[i] = sc.nextInt();
        }
        
        int max = A[0];
        int min = A[0];
        for(int i = 1; i < N; ++i) {
                if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[i];
                }
        }

        System.out.println(max- min);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int [N];
        for (int i = 0; i < N; ++i) {
                A[i] = sc.nextInt();
        }
        
        int max = A[0];
        int min = A[0];
        for(int i = 1; i < N; ++i) {
                if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[i];
                }
        }

        System.out.println(max- min);
	}
} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int [N];
        for (int i = 0; i < N; ++i) {
                A[i] = sc.nextInt();
        }
        
        int max = A[0];
        int min = A[0];
        for(int i = 1; i < N; ++i) {
                if (A[i] > max) {
                        max = A[i];
                } else if (A[i] < min) {
                        min = A[i];
                }
        }

        System.out.println(max- min);
	}
}
