import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> list = new ArrayList<>(n);
    for(int i = 0;i < n; i++){
      list.add(sc.nextInt());
      }
    Collections.sort(list);
    System.out.println(Math.abs(list.get(list.size() -1) - list.get(0)));
                       }} import java.util.*; util.* java public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> list = new ArrayList<>(n);
    for(int i = 0;i < n; i++){
      list.add(sc.nextInt());
      }
    Collections.sort(list);
    System.out.println(Math.abs(list.get(list.size() -1) - list.get(0)));
                       }} Main public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> list = new ArrayList<>(n);
    for(int i = 0;i < n; i++){
      list.add(sc.nextInt());
      }
    Collections.sort(list);
    System.out.println(Math.abs(list.get(list.size() -1) - list.get(0)));
                       } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> list = new ArrayList<>(n);
    for(int i = 0;i < n; i++){
      list.add(sc.nextInt());
      }
    Collections.sort(list);
    System.out.println(Math.abs(list.get(list.size() -1) - list.get(0)));
                       } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc List<Integer> list = new ArrayList<>(n); list new ArrayList<>(n) for(int i = 0;i < n; i++){
      list.add(sc.nextInt());
      } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      list.add(sc.nextInt());
      } {
      list.add(sc.nextInt());
      } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc Collections.sort(list) Collections.sort Collections list System.out.println(Math.abs(list.get(list.size() -1) - list.get(0))) System.out.println System.out System System.out Math.abs(list.get(list.size() -1) - list.get(0)) Math.abs Math list.get(list.size() -1) - list.get(0) list.get(list.size() -1) list.get list list.size() -1 list.size() list.size list 1 list.get(0) list.get list 0 String args[] args public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> list = new ArrayList<>(n);
    for(int i = 0;i < n; i++){
      list.add(sc.nextInt());
      }
    Collections.sort(list);
    System.out.println(Math.abs(list.get(list.size() -1) - list.get(0)));
                       }} public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> list = new ArrayList<>(n);
    for(int i = 0;i < n; i++){
      list.add(sc.nextInt());
      }
    Collections.sort(list);
    System.out.println(Math.abs(list.get(list.size() -1) - list.get(0)));
                       }} Main
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> list = new ArrayList<>(n);
    for(int i = 0;i < n; i++){
      list.add(sc.nextInt());
      }
    Collections.sort(list);
    System.out.println(Math.abs(list.get(list.size() -1) - list.get(0)));
                       }}
