import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int[] a = new int[n];
    int min = 1000000000;
    int max = 0;
    String[] str = in.readLine().split(" ");
    for(int i=0; i<n; i++) {
      a[i] = Integer.parseInt(str[i]);
      min = Math.min(min,a[i]);
      max = Math.max(max,a[i]);
    }
    System.out.println(max-min);
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int[] a = new int[n];
    int min = 1000000000;
    int max = 0;
    String[] str = in.readLine().split(" ");
    for(int i=0; i<n; i++) {
      a[i] = Integer.parseInt(str[i]);
      min = Math.min(min,a[i]);
      max = Math.max(max,a[i]);
    }
    System.out.println(max-min);
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int[] a = new int[n];
    int min = 1000000000;
    int max = 0;
    String[] str = in.readLine().split(" ");
    for(int i=0; i<n; i++) {
      a[i] = Integer.parseInt(str[i]);
      min = Math.min(min,a[i]);
      max = Math.max(max,a[i]);
    }
    System.out.println(max-min);
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int[] a = new int[n];
    int min = 1000000000;
    int max = 0;
    String[] str = in.readLine().split(" ");
    for(int i=0; i<n; i++) {
      a[i] = Integer.parseInt(str[i]);
      min = Math.min(min,a[i]);
      max = Math.max(max,a[i]);
    }
    System.out.println(max-min);
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(in.readLine()); n Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in int[] a = new int[n]; a new int[n] n int min = 1000000000; min 1000000000 int max = 0; max 0 String[] str = in.readLine().split(" "); str in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " for(int i=0; i<n; i++) {
      a[i] = Integer.parseInt(str[i]);
      min = Math.min(min,a[i]);
      max = Math.max(max,a[i]);
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      a[i] = Integer.parseInt(str[i]);
      min = Math.min(min,a[i]);
      max = Math.max(max,a[i]);
    } {
      a[i] = Integer.parseInt(str[i]);
      min = Math.min(min,a[i]);
      max = Math.max(max,a[i]);
    } a[i] = Integer.parseInt(str[i]) a[i] a i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i min = Math.min(min,a[i]) min Math.min(min,a[i]) Math.min Math min a[i] a i max = Math.max(max,a[i]) max Math.max(max,a[i]) Math.max Math max a[i] a 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) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int[] a = new int[n];
    int min = 1000000000;
    int max = 0;
    String[] str = in.readLine().split(" ");
    for(int i=0; i<n; i++) {
      a[i] = Integer.parseInt(str[i]);
      min = Math.min(min,a[i]);
      max = Math.max(max,a[i]);
    }
    System.out.println(max-min);
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int[] a = new int[n];
    int min = 1000000000;
    int max = 0;
    String[] str = in.readLine().split(" ");
    for(int i=0; i<n; i++) {
      a[i] = Integer.parseInt(str[i]);
      min = Math.min(min,a[i]);
      max = Math.max(max,a[i]);
    }
    System.out.println(max-min);
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    int[] a = new int[n];
    int min = 1000000000;
    int max = 0;
    String[] str = in.readLine().split(" ");
    for(int i=0; i<n; i++) {
      a[i] = Integer.parseInt(str[i]);
      min = Math.min(min,a[i]);
      max = Math.max(max,a[i]);
    }
    System.out.println(max-min);
  }
}