import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] param = new int[n];
    
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int max = param[n-1];
    int min = param[0];
    
    int abs = max-min;
    System.out.println(abs);
  }
} import java.util.*; util.* java class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] param = new int[n];
    
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int max = param[n-1];
    int min = param[0];
    
    int abs = max-min;
    System.out.println(abs);
  }
} Main public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] param = new int[n];
    
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int max = param[n-1];
    int min = param[0];
    
    int abs = max-min;
    System.out.println(abs);
  } main {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] param = new int[n];
    
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int max = param[n-1];
    int min = param[0];
    
    int abs = max-min;
    System.out.println(abs);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] param = new int[n]; param new int[n] n for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    } int i=0 ; int i=0 ; i 0 i<n i n i++ i++ i {
      param[i] = sc.nextInt();
    } {
      param[i] = sc.nextInt();
    } param[i] = sc.nextInt() param[i] param i sc.nextInt() sc.nextInt sc Arrays.sort(param) Arrays.sort Arrays param int max = param[n-1]; max param[n-1] param n-1 n 1 int min = param[0]; min param[0] param 0 int abs = max-min; abs max-min max min System.out.println(abs) System.out.println System.out System System.out abs 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[] param = new int[n];
    
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int max = param[n-1];
    int min = param[0];
    
    int abs = max-min;
    System.out.println(abs);
  }
}