import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		A = new int[N];
	}

	public boolean hasNext() {
		// return cnt < N;
		return cnt < 1;
	}

	public void readBody(String str) {
		// System.out.println(str);
		String[] strArr = str.split(" ");
		for (int i = 0; i < N; i++) {
			A[i] = Integer.parseInt(strArr[i]);
		}
		cnt++;
	}

	int[] A;

	public void solve() {
		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			if (A[i] < min)
				min = A[i];
			if (A[i] > max)
				max = A[i];
		}
		System.out.println(max - min);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
} Main public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) Solver solver = new Solver(); solver new Solver() solver.init() solver.init solver solver.readHead(in.readLine()) solver.readHead solver in.readLine() in.readLine in for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		} ; solver.hasNext() solver.hasNext solver {
			solver.readBody(in.readLine());
		} {
			solver.readBody(in.readLine());
		} solver.readBody(in.readLine()) solver.readBody solver in.readLine() in.readLine in solver.solve() solver.solve solver String args[] args class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		A = new int[N];
	}

	public boolean hasNext() {
		// return cnt < N;
		return cnt < 1;
	}

	public void readBody(String str) {
		// System.out.println(str);
		String[] strArr = str.split(" ");
		for (int i = 0; i < N; i++) {
			A[i] = Integer.parseInt(strArr[i]);
		}
		cnt++;
	}

	int[] A;

	public void solve() {
		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			if (A[i] < min)
				min = A[i];
			if (A[i] > max)
				max = A[i];
		}
		System.out.println(max - min);
	}
} Solver int N; N int cnt; cnt int[] A; A public void init() {
		N = 0;
		cnt = 0;
	} init {
		N = 0;
		cnt = 0;
	} N = 0 N 0 cnt = 0 cnt 0 public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		A = new int[N];
	} readHead {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		A = new int[N];
	} String[] strArr = str.split(" "); strArr str.split(" ") str.split str " " N = Integer.parseInt(strArr[0]) N Integer.parseInt(strArr[0]) Integer.parseInt Integer strArr[0] strArr 0 A = new int[N] A new int[N] N String str str public boolean hasNext() {
		// return cnt < N;
		return cnt < 1;
	} hasNext {
		// return cnt < N;
		return cnt < 1;
	} return cnt < 1; cnt < 1 cnt 1 public void readBody(String str) {
		// System.out.println(str);
		String[] strArr = str.split(" ");
		for (int i = 0; i < N; i++) {
			A[i] = Integer.parseInt(strArr[i]);
		}
		cnt++;
	} readBody {
		// System.out.println(str);
		String[] strArr = str.split(" ");
		for (int i = 0; i < N; i++) {
			A[i] = Integer.parseInt(strArr[i]);
		}
		cnt++;
	} String[] strArr = str.split(" "); strArr str.split(" ") str.split str " " for (int i = 0; i < N; i++) {
			A[i] = Integer.parseInt(strArr[i]);
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			A[i] = Integer.parseInt(strArr[i]);
		} {
			A[i] = Integer.parseInt(strArr[i]);
		} A[i] = Integer.parseInt(strArr[i]) A[i] A i Integer.parseInt(strArr[i]) Integer.parseInt Integer strArr[i] strArr i cnt++ cnt String str str public void solve() {
		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			if (A[i] < min)
				min = A[i];
			if (A[i] > max)
				max = A[i];
		}
		System.out.println(max - min);
	} solve {
		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			if (A[i] < min)
				min = A[i];
			if (A[i] > max)
				max = A[i];
		}
		System.out.println(max - min);
	} int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE for (int i = 0; i < N; i++) {
			if (A[i] < min)
				min = A[i];
			if (A[i] > max)
				max = A[i];
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			if (A[i] < min)
				min = A[i];
			if (A[i] > max)
				max = A[i];
		} {
			if (A[i] < min)
				min = A[i];
			if (A[i] > max)
				max = A[i];
		} if (A[i] < min)
				min = A[i]; A[i] < min A[i] A i min min = A[i] min A[i] A i if (A[i] > max)
				max = A[i]; A[i] > max A[i] A i max max = A[i] max A[i] A i System.out.println(max - min) System.out.println System.out System System.out max - min max min
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		A = new int[N];
	}

	public boolean hasNext() {
		// return cnt < N;
		return cnt < 1;
	}

	public void readBody(String str) {
		// System.out.println(str);
		String[] strArr = str.split(" ");
		for (int i = 0; i < N; i++) {
			A[i] = Integer.parseInt(strArr[i]);
		}
		cnt++;
	}

	int[] A;

	public void solve() {
		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			if (A[i] < min)
				min = A[i];
			if (A[i] > max)
				max = A[i];
		}
		System.out.println(max - min);
	}
}
