import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int min = Integer.MAX_VALUE;
	int max = 0;
	int val = 0;
	for(int i=0;i<N;i++){
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	}
	System.out.print(max-min);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int min = Integer.MAX_VALUE;
	int max = 0;
	int val = 0;
	for(int i=0;i<N;i++){
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	}
	System.out.print(max-min);
    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int min = Integer.MAX_VALUE;
	int max = 0;
	int val = 0;
	for(int i=0;i<N;i++){
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	}
	System.out.print(max-min);
    } main {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int min = Integer.MAX_VALUE;
	int max = 0;
	int val = 0;
	for(int i=0;i<N;i++){
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	}
	System.out.print(max-min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int max = 0; max 0 int val = 0; val 0 for(int i=0;i<N;i++){
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	} int i=0; int i=0; i 0 i<N i N i++ i++ i {
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	} {
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	} val = sc.nextInt() val sc.nextInt() sc.nextInt sc if(val > max) max = val; val > max val max max = val max val if(val < min) min = val; val < min val min min = val min val System.out.print(max-min) System.out.print System.out System System.out max-min max min String[] args args public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int min = Integer.MAX_VALUE;
	int max = 0;
	int val = 0;
	for(int i=0;i<N;i++){
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	}
	System.out.print(max-min);
    }
} public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int min = Integer.MAX_VALUE;
	int max = 0;
	int val = 0;
	for(int i=0;i<N;i++){
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	}
	System.out.print(max-min);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int min = Integer.MAX_VALUE;
	int max = 0;
	int val = 0;
	for(int i=0;i<N;i++){
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	}
	System.out.print(max-min);
    }
}
