import java.util.*;
public class Main {

		static void solve() {
			Scanner sc = new Scanner (System.in);
			int n = sc.nextInt();
			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;
			int[] array = new int [n];
			for(int i = 0;i<n;i++) {
				array[i] = sc.nextInt();
			}
			sc.close();
			for(int i = 0;i<n;i++) {
				if(array[i]<=min) {
					min = array[i];
				}
				if(array[i]>=max) {
					max = array[i];
				}
			}
			System.out.println(max - min);
		}
	public static void main(String[] args) {
		solve();

	}

} import java.util.*; util.* java public class Main {

		static void solve() {
			Scanner sc = new Scanner (System.in);
			int n = sc.nextInt();
			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;
			int[] array = new int [n];
			for(int i = 0;i<n;i++) {
				array[i] = sc.nextInt();
			}
			sc.close();
			for(int i = 0;i<n;i++) {
				if(array[i]<=min) {
					min = array[i];
				}
				if(array[i]>=max) {
					max = array[i];
				}
			}
			System.out.println(max - min);
		}
	public static void main(String[] args) {
		solve();

	}

} Main static void solve() {
			Scanner sc = new Scanner (System.in);
			int n = sc.nextInt();
			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;
			int[] array = new int [n];
			for(int i = 0;i<n;i++) {
				array[i] = sc.nextInt();
			}
			sc.close();
			for(int i = 0;i<n;i++) {
				if(array[i]<=min) {
					min = array[i];
				}
				if(array[i]>=max) {
					max = array[i];
				}
			}
			System.out.println(max - min);
		} solve {
			Scanner sc = new Scanner (System.in);
			int n = sc.nextInt();
			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;
			int[] array = new int [n];
			for(int i = 0;i<n;i++) {
				array[i] = sc.nextInt();
			}
			sc.close();
			for(int i = 0;i<n;i++) {
				if(array[i]<=min) {
					min = array[i];
				}
				if(array[i]>=max) {
					max = array[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 max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int[] array = new int [n]; array new int [n] n for(int i = 0;i<n;i++) {
				array[i] = sc.nextInt();
			} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
				array[i] = sc.nextInt();
			} {
				array[i] = sc.nextInt();
			} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc sc.close() sc.close sc for(int i = 0;i<n;i++) {
				if(array[i]<=min) {
					min = array[i];
				}
				if(array[i]>=max) {
					max = array[i];
				}
			} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
				if(array[i]<=min) {
					min = array[i];
				}
				if(array[i]>=max) {
					max = array[i];
				}
			} {
				if(array[i]<=min) {
					min = array[i];
				}
				if(array[i]>=max) {
					max = array[i];
				}
			} if(array[i]<=min) {
					min = array[i];
				} array[i]<=min array[i] array i min {
					min = array[i];
				} min = array[i] min array[i] array i if(array[i]>=max) {
					max = array[i];
				} array[i]>=max array[i] array i max {
					max = array[i];
				} max = array[i] max array[i] array i System.out.println(max - min) System.out.println System.out System System.out max - min max min public static void main(String[] args) {
		solve();

	} main {
		solve();

	} solve() solve String[] args args public class Main {

		static void solve() {
			Scanner sc = new Scanner (System.in);
			int n = sc.nextInt();
			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;
			int[] array = new int [n];
			for(int i = 0;i<n;i++) {
				array[i] = sc.nextInt();
			}
			sc.close();
			for(int i = 0;i<n;i++) {
				if(array[i]<=min) {
					min = array[i];
				}
				if(array[i]>=max) {
					max = array[i];
				}
			}
			System.out.println(max - min);
		}
	public static void main(String[] args) {
		solve();

	}

} public class Main {

		static void solve() {
			Scanner sc = new Scanner (System.in);
			int n = sc.nextInt();
			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;
			int[] array = new int [n];
			for(int i = 0;i<n;i++) {
				array[i] = sc.nextInt();
			}
			sc.close();
			for(int i = 0;i<n;i++) {
				if(array[i]<=min) {
					min = array[i];
				}
				if(array[i]>=max) {
					max = array[i];
				}
			}
			System.out.println(max - min);
		}
	public static void main(String[] args) {
		solve();

	}

} Main
import java.util.*;
public class Main {

		static void solve() {
			Scanner sc = new Scanner (System.in);
			int n = sc.nextInt();
			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;
			int[] array = new int [n];
			for(int i = 0;i<n;i++) {
				array[i] = sc.nextInt();
			}
			sc.close();
			for(int i = 0;i<n;i++) {
				if(array[i]<=min) {
					min = array[i];
				}
				if(array[i]>=max) {
					max = array[i];
				}
			}
			System.out.println(max - min);
		}
	public static void main(String[] args) {
		solve();

	}

}
