import java.util.Scanner;

public class Main {
	static Scanner in = new Scanner(System.in);
	public static void main(String[] args){
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		
		int min = 1000;
		int max = 0;
		for(int i = 0; i < n; i++){
			min = Math.min(min, a[i]);
			max = Math.max(max, a[i]);
		}
		
		System.out.println(max - min);
	}
	

}
