import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] nums = new int[n];
        int min = 1;
        int max = 1;
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        }
        System.out.println(Math.abs(max - min));
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] nums = new int[n];
        int min = 1;
        int max = 1;
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        }
        System.out.println(Math.abs(max - min));
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] nums = new int[n];
        int min = 1;
        int max = 1;
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        }
        System.out.println(Math.abs(max - min));
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] nums = new int[n];
        int min = 1;
        int max = 1;
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        }
        System.out.println(Math.abs(max - min));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] nums = new int[n]; nums new int[n] n int min = 1; min 1 int max = 1; max 1 for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        } {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        } nums[i] = Integer.parseInt(sc.next()) nums[i] nums i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if (i == 0) min = nums[i]; i == 0 i 0 min = nums[i] min nums[i] nums i max = (nums[i] > max) ? nums[i] : max max (nums[i] > max) ? nums[i] : max (nums[i] > max) nums[i] nums i max nums[i] nums i max min = (nums[i] < min) ? nums[i] : min min (nums[i] < min) ? nums[i] : min (nums[i] < min) nums[i] nums i min nums[i] nums i min System.out.println(Math.abs(max - min)) System.out.println System.out System System.out Math.abs(max - min) Math.abs Math max - min max min String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] nums = new int[n];
        int min = 1;
        int max = 1;
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        }
        System.out.println(Math.abs(max - min));
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] nums = new int[n];
        int min = 1;
        int max = 1;
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        }
        System.out.println(Math.abs(max - min));
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] nums = new int[n];
        int min = 1;
        int max = 1;
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(sc.next());
            // 1回目のループのみminをセット
            if (i == 0) min = nums[i];
            max = (nums[i] > max) ? nums[i] : max; 
            min = (nums[i] < min) ? nums[i] : min;
        }
        System.out.println(Math.abs(max - min));
    }
}
