import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n=stdIn.nextInt(),a,i,min=1000000000,max=0;
		for(i=0;i<n;i++) {
			a=stdIn.nextInt();
			if(min>a) min=a;
			if(a>max) max=a;
		}
		System.out.print(max-min);
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n=stdIn.nextInt(),a,i,min=1000000000,max=0;
		for(i=0;i<n;i++) {
			a=stdIn.nextInt();
			if(min>a) min=a;
			if(a>max) max=a;
		}
		System.out.print(max-min);
	}
} Main public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n=stdIn.nextInt(),a,i,min=1000000000,max=0;
		for(i=0;i<n;i++) {
			a=stdIn.nextInt();
			if(min>a) min=a;
			if(a>max) max=a;
		}
		System.out.print(max-min);
	} main {
		Scanner stdIn=new Scanner(System.in);
		int n=stdIn.nextInt(),a,i,min=1000000000,max=0;
		for(i=0;i<n;i++) {
			a=stdIn.nextInt();
			if(min>a) min=a;
			if(a>max) max=a;
		}
		System.out.print(max-min);
	} Scanner stdIn=new Scanner(System.in); stdIn new Scanner(System.in) int n=stdIn.nextInt() n stdIn.nextInt() stdIn.nextInt stdIn a a i i min=1000000000 min 1000000000 max=0; max 0 for(i=0;i<n;i++) {
			a=stdIn.nextInt();
			if(min>a) min=a;
			if(a>max) max=a;
		} i=0; i=0 i 0 i<n i n i++ i++ i {
			a=stdIn.nextInt();
			if(min>a) min=a;
			if(a>max) max=a;
		} {
			a=stdIn.nextInt();
			if(min>a) min=a;
			if(a>max) max=a;
		} a=stdIn.nextInt() a stdIn.nextInt() stdIn.nextInt stdIn if(min>a) min=a; min>a min a min=a min a if(a>max) max=a; a>max a max max=a max a System.out.print(max-min) System.out.print System.out System System.out max-min max min String[] args args
import java.util.Scanner;

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