import java.util.*;

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

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = sc.nextInt();
    int b = a;
    int m;
    for (int i = 0;i<n-1;i++) {
      m = sc.nextInt();
      if (m<a) a=m;
      if (b<m) b=m;
    }
    System.out.println(b-a);
  }
}
