import java.util.Scanner;

public class Main {
public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);
	int n = scanner.nextInt();
	int max = 0;
	int min = 1000;
	for (int i = 0; i < n; i++) {
		int t = scanner.nextInt();
		if (t > max) {
			max = t;
		} else if (t < min) {
			min = t;
		}
	}
	System.out.println(max-min);
	scanner.close();
}
}
