import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int[] array = new int[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);
        System.out.println(array[array.length-1]-array[0]);
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int[] array = new int[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);
        System.out.println(array[array.length-1]-array[0]);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int[] array = new int[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);
        System.out.println(array[array.length-1]-array[0]);
    } main {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int[] array = new int[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);
        System.out.println(array[array.length-1]-array[0]);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int givenNumber = scanner.nextInt(); givenNumber scanner.nextInt() scanner.nextInt scanner int[] array = new int[givenNumber]; array new int[givenNumber] givenNumber for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextInt();
        } int i=0; int i=0; i 0 i<givenNumber i givenNumber i++ i++ i {
            array[i] = scanner.nextInt();
        } {
            array[i] = scanner.nextInt();
        } array[i] = scanner.nextInt() array[i] array i scanner.nextInt() scanner.nextInt scanner Arrays.sort(array) Arrays.sort Arrays array System.out.println(array[array.length-1]-array[0]) System.out.println System.out System System.out array[array.length-1]-array[0] array[array.length-1] array array.length-1 array.length array array.length 1 array[0] array 0 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int[] array = new int[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);
        System.out.println(array[array.length-1]-array[0]);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int[] array = new int[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);
        System.out.println(array[array.length-1]-array[0]);
    }
} Main
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int[] array = new int[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);
        System.out.println(array[array.length-1]-array[0]);
    }
}
