import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int size = sc.nextInt();
    int zero = sc.nextInt();
    int min = zero;
    int max = zero;
    for(int i = 1; i < size; i++){
      int a = sc.nextInt();
      if(a < min){
        min = a;
      }
      if(a > max){
        max = a;
      }
    }
    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 size = sc.nextInt();
    int zero = sc.nextInt();
    int min = zero;
    int max = zero;
    for(int i = 1; i < size; i++){
      int a = sc.nextInt();
      if(a < min){
        min = a;
      }
      if(a > max){
        max = a;
      }
    }
    System.out.println(max - min);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int size = sc.nextInt();
    int zero = sc.nextInt();
    int min = zero;
    int max = zero;
    for(int i = 1; i < size; i++){
      int a = sc.nextInt();
      if(a < min){
        min = a;
      }
      if(a > max){
        max = a;
      }
    }
    System.out.println(max - min);
	} main {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int size = sc.nextInt();
    int zero = sc.nextInt();
    int min = zero;
    int max = zero;
    for(int i = 1; i < size; i++){
      int a = sc.nextInt();
      if(a < min){
        min = a;
      }
      if(a > max){
        max = a;
      }
    }
    System.out.println(max - min);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int size = sc.nextInt(); size sc.nextInt() sc.nextInt sc int zero = sc.nextInt(); zero sc.nextInt() sc.nextInt sc int min = zero; min zero int max = zero; max zero for(int i = 1; i < size; i++){
      int a = sc.nextInt();
      if(a < min){
        min = a;
      }
      if(a > max){
        max = a;
      }
    } int i = 1; int i = 1; i 1 i < size i size i++ i++ i {
      int a = sc.nextInt();
      if(a < min){
        min = a;
      }
      if(a > max){
        max = a;
      }
    } {
      int a = sc.nextInt();
      if(a < min){
        min = a;
      }
      if(a > max){
        max = a;
      }
    } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc if(a < min){
        min = a;
      } a < min a min {
        min = a;
      } min = a min a if(a > max){
        max = a;
      } a > max a max {
        max = a;
      } max = a max a 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 size = sc.nextInt();
    int zero = sc.nextInt();
    int min = zero;
    int max = zero;
    for(int i = 1; i < size; i++){
      int a = sc.nextInt();
      if(a < min){
        min = a;
      }
      if(a > max){
        max = a;
      }
    }
    System.out.println(max - min);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int size = sc.nextInt();
    int zero = sc.nextInt();
    int min = zero;
    int max = zero;
    for(int i = 1; i < size; i++){
      int a = sc.nextInt();
      if(a < min){
        min = a;
      }
      if(a > max){
        max = a;
      }
    }
    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 size = sc.nextInt();
    int zero = sc.nextInt();
    int min = zero;
    int max = zero;
    for(int i = 1; i < size; i++){
      int a = sc.nextInt();
      if(a < min){
        min = a;
      }
      if(a > max){
        max = a;
      }
    }
    System.out.println(max - min);
	}
}