import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
		try{
			Scanner sc = new Scanner(System.in);
			int N = sc.nextInt();
			int[] list = new int[N];
			for(int i = 0; i < N; i++){
				list[i] = sc.nextInt();
			}
			Arrays.sort(list);
			System.out.println(list[N-1] - list[0]);
		}catch(Exception e){
			e.printStackTrace();
		}
	} 
}