import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

     int max = Integer.MIN_VALUE;
     int min = Integer.MAX_VALUE;
     Scanner in = new Scanner(System.in);
     int N = in.nextInt();
     while(in.hasNext()){
         int cur = in.nextInt();
         max = Math.max(max,cur);
         min = Math.min(min,cur);
     }
        System.out.println(max-min);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {

     int max = Integer.MIN_VALUE;
     int min = Integer.MAX_VALUE;
     Scanner in = new Scanner(System.in);
     int N = in.nextInt();
     while(in.hasNext()){
         int cur = in.nextInt();
         max = Math.max(max,cur);
         min = Math.min(min,cur);
     }
        System.out.println(max-min);
    }
} Main public static void main(String[] args) {

     int max = Integer.MIN_VALUE;
     int min = Integer.MAX_VALUE;
     Scanner in = new Scanner(System.in);
     int N = in.nextInt();
     while(in.hasNext()){
         int cur = in.nextInt();
         max = Math.max(max,cur);
         min = Math.min(min,cur);
     }
        System.out.println(max-min);
    } main {

     int max = Integer.MIN_VALUE;
     int min = Integer.MAX_VALUE;
     Scanner in = new Scanner(System.in);
     int N = in.nextInt();
     while(in.hasNext()){
         int cur = in.nextInt();
         max = Math.max(max,cur);
         min = Math.min(min,cur);
     }
        System.out.println(max-min);
    } int max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE Scanner in = new Scanner(System.in); in new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in while(in.hasNext()){
         int cur = in.nextInt();
         max = Math.max(max,cur);
         min = Math.min(min,cur);
     } in.hasNext() in.hasNext in {
         int cur = in.nextInt();
         max = Math.max(max,cur);
         min = Math.min(min,cur);
     } int cur = in.nextInt(); cur in.nextInt() in.nextInt in max = Math.max(max,cur) max Math.max(max,cur) Math.max Math max cur min = Math.min(min,cur) min Math.min(min,cur) Math.min Math min cur 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) {

     int max = Integer.MIN_VALUE;
     int min = Integer.MAX_VALUE;
     Scanner in = new Scanner(System.in);
     int N = in.nextInt();
     while(in.hasNext()){
         int cur = in.nextInt();
         max = Math.max(max,cur);
         min = Math.min(min,cur);
     }
        System.out.println(max-min);
    }
} public class Main {
    public static void main(String[] args) {

     int max = Integer.MIN_VALUE;
     int min = Integer.MAX_VALUE;
     Scanner in = new Scanner(System.in);
     int N = in.nextInt();
     while(in.hasNext()){
         int cur = in.nextInt();
         max = Math.max(max,cur);
         min = Math.min(min,cur);
     }
        System.out.println(max-min);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

     int max = Integer.MIN_VALUE;
     int min = Integer.MAX_VALUE;
     Scanner in = new Scanner(System.in);
     int N = in.nextInt();
     while(in.hasNext()){
         int cur = in.nextInt();
         max = Math.max(max,cur);
         min = Math.min(min,cur);
     }
        System.out.println(max-min);
    }
}