import java.util.*;

class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N=sc.nextInt();
int a1=sc.nextInt();
int max=a1;
int min=a1;
for(int i=2;i<=N;i++){
  int a = sc.nextInt();
if(max<a)
max=a;
if(min>a)
min=a;
}
System.out.println(max-min);
}
} import java.util.*; util.* java class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N=sc.nextInt();
int a1=sc.nextInt();
int max=a1;
int min=a1;
for(int i=2;i<=N;i++){
  int a = sc.nextInt();
if(max<a)
max=a;
if(min>a)
min=a;
}
System.out.println(max-min);
}
} Main public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N=sc.nextInt();
int a1=sc.nextInt();
int max=a1;
int min=a1;
for(int i=2;i<=N;i++){
  int a = sc.nextInt();
if(max<a)
max=a;
if(min>a)
min=a;
}
System.out.println(max-min);
} main {
Scanner sc = new Scanner(System.in);
int N=sc.nextInt();
int a1=sc.nextInt();
int max=a1;
int min=a1;
for(int i=2;i<=N;i++){
  int a = sc.nextInt();
if(max<a)
max=a;
if(min>a)
min=a;
}
System.out.println(max-min);
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int a1=sc.nextInt(); a1 sc.nextInt() sc.nextInt sc int max=a1; max a1 int min=a1; min a1 for(int i=2;i<=N;i++){
  int a = sc.nextInt();
if(max<a)
max=a;
if(min>a)
min=a;
} int i=2; int i=2; i 2 i<=N i N i++ i++ i {
  int a = sc.nextInt();
if(max<a)
max=a;
if(min>a)
min=a;
} {
  int a = sc.nextInt();
if(max<a)
max=a;
if(min>a)
min=a;
} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc if(max<a)
max=a; max<a max a max=a max a if(min>a)
min=a; min>a min a min=a min a System.out.println(max-min) System.out.println System.out System System.out max-min max min String[] args args
import java.util.*;

class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N=sc.nextInt();
int a1=sc.nextInt();
int max=a1;
int min=a1;
for(int i=2;i<=N;i++){
  int a = sc.nextInt();
if(max<a)
max=a;
if(min>a)
min=a;
}
System.out.println(max-min);
}
}
