import java.lang.*;
import java.io.*;
import java.util.*;

class Main{
	public static void main(String args[]) throws FileNotFoundException{
		Scanner sc=new Scanner(System.in);
		int n=Integer.parseInt(sc.nextLine());
		int[] num=new int[n];
		String[] buf=sc.nextLine().split(" ");
		for(int i=0; i<n; i++){
			num[i]=Integer.parseInt(buf[i]);
		}
		Arrays.sort(num);
		
		System.out.println(Math.abs(num[0]-num[num.length-1]));
	}

	static void disp(int[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	}
} import java.lang.*; lang.* java import java.io.*; io.* java import java.util.*; util.* java class Main{
	public static void main(String args[]) throws FileNotFoundException{
		Scanner sc=new Scanner(System.in);
		int n=Integer.parseInt(sc.nextLine());
		int[] num=new int[n];
		String[] buf=sc.nextLine().split(" ");
		for(int i=0; i<n; i++){
			num[i]=Integer.parseInt(buf[i]);
		}
		Arrays.sort(num);
		
		System.out.println(Math.abs(num[0]-num[num.length-1]));
	}

	static void disp(int[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	}
} Main public static void main(String args[]) throws FileNotFoundException{
		Scanner sc=new Scanner(System.in);
		int n=Integer.parseInt(sc.nextLine());
		int[] num=new int[n];
		String[] buf=sc.nextLine().split(" ");
		for(int i=0; i<n; i++){
			num[i]=Integer.parseInt(buf[i]);
		}
		Arrays.sort(num);
		
		System.out.println(Math.abs(num[0]-num[num.length-1]));
	} main {
		Scanner sc=new Scanner(System.in);
		int n=Integer.parseInt(sc.nextLine());
		int[] num=new int[n];
		String[] buf=sc.nextLine().split(" ");
		for(int i=0; i<n; i++){
			num[i]=Integer.parseInt(buf[i]);
		}
		Arrays.sort(num);
		
		System.out.println(Math.abs(num[0]-num[num.length-1]));
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int[] num=new int[n]; num new int[n] n String[] buf=sc.nextLine().split(" "); buf sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " for(int i=0; i<n; i++){
			num[i]=Integer.parseInt(buf[i]);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			num[i]=Integer.parseInt(buf[i]);
		} {
			num[i]=Integer.parseInt(buf[i]);
		} num[i]=Integer.parseInt(buf[i]) num[i] num i Integer.parseInt(buf[i]) Integer.parseInt Integer buf[i] buf i Arrays.sort(num) Arrays.sort Arrays num System.out.println(Math.abs(num[0]-num[num.length-1])) System.out.println System.out System System.out Math.abs(num[0]-num[num.length-1]) Math.abs Math num[0]-num[num.length-1] num[0] num 0 num[num.length-1] num num.length-1 num.length num num.length 1 String args[] args static void disp(int[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	} disp {
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	} for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		} int i=0; int i=0; i 0 i<data.length i data.length data data.length i++ i++ i {
				System.out.printf("%d ",data[i]);
		} {
				System.out.printf("%d ",data[i]);
		} System.out.printf("%d ",data[i]) System.out.printf System.out System System.out "%d " data[i] data i System.out.println() System.out.println System.out System System.out int[] data data
import java.lang.*;
import java.io.*;
import java.util.*;

class Main{
	public static void main(String args[]) throws FileNotFoundException{
		Scanner sc=new Scanner(System.in);
		int n=Integer.parseInt(sc.nextLine());
		int[] num=new int[n];
		String[] buf=sc.nextLine().split(" ");
		for(int i=0; i<n; i++){
			num[i]=Integer.parseInt(buf[i]);
		}
		Arrays.sort(num);
		
		System.out.println(Math.abs(num[0]-num[num.length-1]));
	}

	static void disp(int[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	}
}
