import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int nums = sc.nextInt();

			ArrayList<Integer> list = new ArrayList<Integer>();

			for(int i =0;i<nums;i++) {
				list.add(sc.nextInt());
			}


			Collections.sort(list);

			int num = list.get(list.size()-1) - list.get(0);

			System.out.println(num);



	}


}

 import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int nums = sc.nextInt();

			ArrayList<Integer> list = new ArrayList<Integer>();

			for(int i =0;i<nums;i++) {
				list.add(sc.nextInt());
			}


			Collections.sort(list);

			int num = list.get(list.size()-1) - list.get(0);

			System.out.println(num);



	}


} Main public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int nums = sc.nextInt();

			ArrayList<Integer> list = new ArrayList<Integer>();

			for(int i =0;i<nums;i++) {
				list.add(sc.nextInt());
			}


			Collections.sort(list);

			int num = list.get(list.size()-1) - list.get(0);

			System.out.println(num);



	} main {
			Scanner sc = new Scanner(System.in);
			int nums = sc.nextInt();

			ArrayList<Integer> list = new ArrayList<Integer>();

			for(int i =0;i<nums;i++) {
				list.add(sc.nextInt());
			}


			Collections.sort(list);

			int num = list.get(list.size()-1) - list.get(0);

			System.out.println(num);



	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int nums = sc.nextInt(); nums sc.nextInt() sc.nextInt sc ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for(int i =0;i<nums;i++) {
				list.add(sc.nextInt());
			} int i =0; int i =0; i 0 i<nums i nums i++ i++ i {
				list.add(sc.nextInt());
			} {
				list.add(sc.nextInt());
			} list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc Collections.sort(list) Collections.sort Collections list int num = list.get(list.size()-1) - list.get(0); num list.get(list.size()-1) - list.get(0) list.get(list.size()-1) list.get list list.size()-1 list.size() list.size list 1 list.get(0) list.get list 0 System.out.println(num) System.out.println System.out System System.out num String[] args args public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int nums = sc.nextInt();

			ArrayList<Integer> list = new ArrayList<Integer>();

			for(int i =0;i<nums;i++) {
				list.add(sc.nextInt());
			}


			Collections.sort(list);

			int num = list.get(list.size()-1) - list.get(0);

			System.out.println(num);



	}


} public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int nums = sc.nextInt();

			ArrayList<Integer> list = new ArrayList<Integer>();

			for(int i =0;i<nums;i++) {
				list.add(sc.nextInt());
			}


			Collections.sort(list);

			int num = list.get(list.size()-1) - list.get(0);

			System.out.println(num);



	}


} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int nums = sc.nextInt();

			ArrayList<Integer> list = new ArrayList<Integer>();

			for(int i =0;i<nums;i++) {
				list.add(sc.nextInt());
			}


			Collections.sort(list);

			int num = list.get(list.size()-1) - list.get(0);

			System.out.println(num);



	}


}


