import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        long min = 1000000000;
        long max = 0;
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
            if(Math.abs(a[i])>max) max = Math.abs(a[i]);
            if(Math.abs(a[i])<min) min = Math.abs(a[i]);
        }
        sc.close();
        System.out.println(max-min);
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        long min = 1000000000;
        long max = 0;
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
            if(Math.abs(a[i])>max) max = Math.abs(a[i]);
            if(Math.abs(a[i])<min) min = Math.abs(a[i]);
        }
        sc.close();
        System.out.println(max-min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        long min = 1000000000;
        long max = 0;
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
            if(Math.abs(a[i])>max) max = Math.abs(a[i]);
            if(Math.abs(a[i])<min) min = Math.abs(a[i]);
        }
        sc.close();
        System.out.println(max-min);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        long min = 1000000000;
        long max = 0;
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
            if(Math.abs(a[i])>max) max = Math.abs(a[i]);
            if(Math.abs(a[i])<min) min = Math.abs(a[i]);
        }
        sc.close();
        System.out.println(max-min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n long min = 1000000000; min 1000000000 long max = 0; max 0 for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
            if(Math.abs(a[i])>max) max = Math.abs(a[i]);
            if(Math.abs(a[i])<min) min = Math.abs(a[i]);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            a[i] = sc.nextInt();
            if(Math.abs(a[i])>max) max = Math.abs(a[i]);
            if(Math.abs(a[i])<min) min = Math.abs(a[i]);
        } {
            a[i] = sc.nextInt();
            if(Math.abs(a[i])>max) max = Math.abs(a[i]);
            if(Math.abs(a[i])<min) min = Math.abs(a[i]);
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc if(Math.abs(a[i])>max) max = Math.abs(a[i]); Math.abs(a[i])>max Math.abs(a[i]) Math.abs Math a[i] a i max max = Math.abs(a[i]) max Math.abs(a[i]) Math.abs Math a[i] a i if(Math.abs(a[i])<min) min = Math.abs(a[i]); Math.abs(a[i])<min Math.abs(a[i]) Math.abs Math a[i] a i min min = Math.abs(a[i]) min Math.abs(a[i]) Math.abs Math a[i] a i sc.close() sc.close sc System.out.println(max-min) System.out.println System.out System System.out max-min max min String[] args args
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        long min = 1000000000;
        long max = 0;
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
            if(Math.abs(a[i])>max) max = Math.abs(a[i]);
            if(Math.abs(a[i])<min) min = Math.abs(a[i]);
        }
        sc.close();
        System.out.println(max-min);
    }
}