import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line = sc.nextLine();
        String s[]=line.split(" ",0);
        int a[]=new int[s.length];
        for(int i=0;i<s.length;i++){
            a[i]=Integer.parseInt(s[i]);
        }
        int max= a[0];
        int min=a[0];
 
        for (int i = 1; i < a.length; i ++) {
            max = Math.max(max, a[i]);
            min = Math.min(min, a[i]);
        }
        System.out.println(max-min);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line = sc.nextLine();
        String s[]=line.split(" ",0);
        int a[]=new int[s.length];
        for(int i=0;i<s.length;i++){
            a[i]=Integer.parseInt(s[i]);
        }
        int max= a[0];
        int min=a[0];
 
        for (int i = 1; i < a.length; i ++) {
            max = Math.max(max, a[i]);
            min = Math.min(min, a[i]);
        }
        System.out.println(max-min);
    }
} Main public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line = sc.nextLine();
        String s[]=line.split(" ",0);
        int a[]=new int[s.length];
        for(int i=0;i<s.length;i++){
            a[i]=Integer.parseInt(s[i]);
        }
        int max= a[0];
        int min=a[0];
 
        for (int i = 1; i < a.length; i ++) {
            max = Math.max(max, a[i]);
            min = Math.min(min, a[i]);
        }
        System.out.println(max-min);
    } main {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line = sc.nextLine();
        String s[]=line.split(" ",0);
        int a[]=new int[s.length];
        for(int i=0;i<s.length;i++){
            a[i]=Integer.parseInt(s[i]);
        }
        int max= a[0];
        int min=a[0];
 
        for (int i = 1; i < a.length; i ++) {
            max = Math.max(max, a[i]);
            min = Math.min(min, a[i]);
        }
        System.out.println(max-min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc line = sc.nextLine() line sc.nextLine() sc.nextLine sc String s[]=line.split(" ",0); s line.split(" ",0) line.split line " " 0 int a[]=new int[s.length]; a new int[s.length] s.length s s.length for(int i=0;i<s.length;i++){
            a[i]=Integer.parseInt(s[i]);
        } int i=0; int i=0; i 0 i<s.length i s.length s s.length i++ i++ i {
            a[i]=Integer.parseInt(s[i]);
        } {
            a[i]=Integer.parseInt(s[i]);
        } a[i]=Integer.parseInt(s[i]) a[i] a i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i int max= a[0]; max a[0] a 0 int min=a[0]; min a[0] a 0 for (int i = 1; i < a.length; i ++) {
            max = Math.max(max, a[i]);
            min = Math.min(min, a[i]);
        } int i = 1; int i = 1; i 1 i < a.length i a.length a a.length i ++ i ++ i {
            max = Math.max(max, a[i]);
            min = Math.min(min, a[i]);
        } {
            max = Math.max(max, a[i]);
            min = Math.min(min, a[i]);
        } max = Math.max(max, a[i]) max Math.max(max, a[i]) Math.max Math max a[i] a i min = Math.min(min, a[i]) min Math.min(min, a[i]) Math.min Math min 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) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line = sc.nextLine();
        String s[]=line.split(" ",0);
        int a[]=new int[s.length];
        for(int i=0;i<s.length;i++){
            a[i]=Integer.parseInt(s[i]);
        }
        int max= a[0];
        int min=a[0];
 
        for (int i = 1; i < a.length; i ++) {
            max = Math.max(max, a[i]);
            min = Math.min(min, a[i]);
        }
        System.out.println(max-min);
    }
} public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line = sc.nextLine();
        String s[]=line.split(" ",0);
        int a[]=new int[s.length];
        for(int i=0;i<s.length;i++){
            a[i]=Integer.parseInt(s[i]);
        }
        int max= a[0];
        int min=a[0];
 
        for (int i = 1; i < a.length; i ++) {
            max = Math.max(max, a[i]);
            min = Math.min(min, a[i]);
        }
        System.out.println(max-min);
    }
} Main
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line = sc.nextLine();
        String s[]=line.split(" ",0);
        int a[]=new int[s.length];
        for(int i=0;i<s.length;i++){
            a[i]=Integer.parseInt(s[i]);
        }
        int max= a[0];
        int min=a[0];
 
        for (int i = 1; i < a.length; i ++) {
            max = Math.max(max, a[i]);
            min = Math.min(min, a[i]);
        }
        System.out.println(max-min);
    }
}