import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int n;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int v[] = new int [n];
        for(int i = 0; i < n; i++)
            v[i] = scan.nextInt();
        int ans = -100000000;
        for(int a : v){
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        int n;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int v[] = new int [n];
        for(int i = 0; i < n; i++)
            v[i] = scan.nextInt();
        int ans = -100000000;
        for(int a : v){
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        int n;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int v[] = new int [n];
        for(int i = 0; i < n; i++)
            v[i] = scan.nextInt();
        int ans = -100000000;
        for(int a : v){
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        }
        System.out.println(ans);
    } main {
        int n;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int v[] = new int [n];
        for(int i = 0; i < n; i++)
            v[i] = scan.nextInt();
        int ans = -100000000;
        for(int a : v){
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        }
        System.out.println(ans);
    } int n; n Scanner scan = new Scanner(System.in); scan new Scanner(System.in) n = scan.nextInt() n scan.nextInt() scan.nextInt scan int v[] = new int [n]; v new int [n] n for(int i = 0; i < n; i++)
            v[i] = scan.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i v[i] = scan.nextInt(); v[i] = scan.nextInt() v[i] v i scan.nextInt() scan.nextInt scan int ans = -100000000; ans -100000000 100000000 for(int a : v){
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        } int a v {
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        } {
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        } for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            } int b v {
                ans = Math.max(ans,Math.abs(a-b));
            } {
                ans = Math.max(ans,Math.abs(a-b));
            } ans = Math.max(ans,Math.abs(a-b)) ans Math.max(ans,Math.abs(a-b)) Math.max Math ans Math.abs(a-b) Math.abs Math a-b a b System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        int n;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int v[] = new int [n];
        for(int i = 0; i < n; i++)
            v[i] = scan.nextInt();
        int ans = -100000000;
        for(int a : v){
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        int n;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int v[] = new int [n];
        for(int i = 0; i < n; i++)
            v[i] = scan.nextInt();
        int ans = -100000000;
        for(int a : v){
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int n;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int v[] = new int [n];
        for(int i = 0; i < n; i++)
            v[i] = scan.nextInt();
        int ans = -100000000;
        for(int a : v){
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        }
        System.out.println(ans);
    }
}
