import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] values = new int[N+1];
        for (int i=1; i<=N; i++) {
            values[i] = sc.nextInt();
        }
        int min = 0;
        int Max = 0;
      
      for (int i=1; i<=N; i++) {
        if (min == 0 || values[i] < min) {
          min = values[i];
        }  
        
        if (Max == 0 || Max < values[i]) {
          Max = values[i];
        }  

      }
            
           
        System.out.println(Max - min);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] values = new int[N+1];
        for (int i=1; i<=N; i++) {
            values[i] = sc.nextInt();
        }
        int min = 0;
        int Max = 0;
      
      for (int i=1; i<=N; i++) {
        if (min == 0 || values[i] < min) {
          min = values[i];
        }  
        
        if (Max == 0 || Max < values[i]) {
          Max = values[i];
        }  

      }
            
           
        System.out.println(Max - min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] values = new int[N+1];
        for (int i=1; i<=N; i++) {
            values[i] = sc.nextInt();
        }
        int min = 0;
        int Max = 0;
      
      for (int i=1; i<=N; i++) {
        if (min == 0 || values[i] < min) {
          min = values[i];
        }  
        
        if (Max == 0 || Max < values[i]) {
          Max = values[i];
        }  

      }
            
           
        System.out.println(Max - min);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] values = new int[N+1];
        for (int i=1; i<=N; i++) {
            values[i] = sc.nextInt();
        }
        int min = 0;
        int Max = 0;
      
      for (int i=1; i<=N; i++) {
        if (min == 0 || values[i] < min) {
          min = values[i];
        }  
        
        if (Max == 0 || Max < values[i]) {
          Max = values[i];
        }  

      }
            
           
        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[] values = new int[N+1]; values new int[N+1] N+1 N 1 for (int i=1; i<=N; i++) {
            values[i] = sc.nextInt();
        } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
            values[i] = sc.nextInt();
        } {
            values[i] = sc.nextInt();
        } values[i] = sc.nextInt() values[i] values i sc.nextInt() sc.nextInt sc int min = 0; min 0 int Max = 0; Max 0 for (int i=1; i<=N; i++) {
        if (min == 0 || values[i] < min) {
          min = values[i];
        }  
        
        if (Max == 0 || Max < values[i]) {
          Max = values[i];
        }  

      } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
        if (min == 0 || values[i] < min) {
          min = values[i];
        }  
        
        if (Max == 0 || Max < values[i]) {
          Max = values[i];
        }  

      } {
        if (min == 0 || values[i] < min) {
          min = values[i];
        }  
        
        if (Max == 0 || Max < values[i]) {
          Max = values[i];
        }  

      } if (min == 0 || values[i] < min) {
          min = values[i];
        } min == 0 || values[i] < min min == 0 min 0 values[i] < min values[i] values i min {
          min = values[i];
        } min = values[i] min values[i] values i if (Max == 0 || Max < values[i]) {
          Max = values[i];
        } Max == 0 || Max < values[i] Max == 0 Max 0 Max < values[i] Max values[i] values i {
          Max = values[i];
        } Max = values[i] Max values[i] values i System.out.println(Max - min) System.out.println 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[] values = new int[N+1];
        for (int i=1; i<=N; i++) {
            values[i] = sc.nextInt();
        }
        int min = 0;
        int Max = 0;
      
      for (int i=1; i<=N; i++) {
        if (min == 0 || values[i] < min) {
          min = values[i];
        }  
        
        if (Max == 0 || Max < values[i]) {
          Max = values[i];
        }  

      }
            
           
        System.out.println(Max - min);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] values = new int[N+1];
        for (int i=1; i<=N; i++) {
            values[i] = sc.nextInt();
        }
        int min = 0;
        int Max = 0;
      
      for (int i=1; i<=N; i++) {
        if (min == 0 || values[i] < min) {
          min = values[i];
        }  
        
        if (Max == 0 || Max < values[i]) {
          Max = values[i];
        }  

      }
            
           
        System.out.println(Max - min);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] values = new int[N+1];
        for (int i=1; i<=N; i++) {
            values[i] = sc.nextInt();
        }
        int min = 0;
        int Max = 0;
      
      for (int i=1; i<=N; i++) {
        if (min == 0 || values[i] < min) {
          min = values[i];
        }  
        
        if (Max == 0 || Max < values[i]) {
          Max = values[i];
        }  

      }
            
           
        System.out.println(Max - min);
    }
}