import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {

static long[] list=new long[87];

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
   
int N=Integer.parseInt(nyuA);

String[] data=sc.nextLine().split(" ");

int[] num=new int[data.length];

for(int i=0;i<data.length;i++){
num[i]=Integer.parseInt(data[i]);
}
Arrays.sort(num);


System.out.println(num[num.length-1]-num[0]);

}

}
 import java.io.*; io.* java import java.util.*; util.* java import java.math.BigInteger; BigInteger java.math public class Main {

static long[] list=new long[87];

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
   
int N=Integer.parseInt(nyuA);

String[] data=sc.nextLine().split(" ");

int[] num=new int[data.length];

for(int i=0;i<data.length;i++){
num[i]=Integer.parseInt(data[i]);
}
Arrays.sort(num);


System.out.println(num[num.length-1]-num[0]);

}

} Main static long[] list=new long[87]; list new long[87] 87 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
   
int N=Integer.parseInt(nyuA);

String[] data=sc.nextLine().split(" ");

int[] num=new int[data.length];

for(int i=0;i<data.length;i++){
num[i]=Integer.parseInt(data[i]);
}
Arrays.sort(num);


System.out.println(num[num.length-1]-num[0]);

} main {
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
   
int N=Integer.parseInt(nyuA);

String[] data=sc.nextLine().split(" ");

int[] num=new int[data.length];

for(int i=0;i<data.length;i++){
num[i]=Integer.parseInt(data[i]);
}
Arrays.sort(num);


System.out.println(num[num.length-1]-num[0]);

} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String nyuA=sc.nextLine(); nyuA sc.nextLine() sc.nextLine sc int N=Integer.parseInt(nyuA); N Integer.parseInt(nyuA) Integer.parseInt Integer nyuA String[] data=sc.nextLine().split(" "); data sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[] num=new int[data.length]; num new int[data.length] data.length data data.length for(int i=0;i<data.length;i++){
num[i]=Integer.parseInt(data[i]);
} int i=0; int i=0; i 0 i<data.length i data.length data data.length i++ i++ i {
num[i]=Integer.parseInt(data[i]);
} {
num[i]=Integer.parseInt(data[i]);
} num[i]=Integer.parseInt(data[i]) num[i] num i Integer.parseInt(data[i]) Integer.parseInt Integer data[i] data i Arrays.sort(num) Arrays.sort Arrays num System.out.println(num[num.length-1]-num[0]) System.out.println System.out System System.out num[num.length-1]-num[0] num[num.length-1] num num.length-1 num.length num num.length 1 num[0] num 0 String[] args args public class Main {

static long[] list=new long[87];

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
   
int N=Integer.parseInt(nyuA);

String[] data=sc.nextLine().split(" ");

int[] num=new int[data.length];

for(int i=0;i<data.length;i++){
num[i]=Integer.parseInt(data[i]);
}
Arrays.sort(num);


System.out.println(num[num.length-1]-num[0]);

}

} public class Main {

static long[] list=new long[87];

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
   
int N=Integer.parseInt(nyuA);

String[] data=sc.nextLine().split(" ");

int[] num=new int[data.length];

for(int i=0;i<data.length;i++){
num[i]=Integer.parseInt(data[i]);
}
Arrays.sort(num);


System.out.println(num[num.length-1]-num[0]);

}

} Main
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {

static long[] list=new long[87];

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
   
int N=Integer.parseInt(nyuA);

String[] data=sc.nextLine().split(" ");

int[] num=new int[data.length];

for(int i=0;i<data.length;i++){
num[i]=Integer.parseInt(data[i]);
}
Arrays.sort(num);


System.out.println(num[num.length-1]-num[0]);

}

}

