import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // 102B - Maximum Difference

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[n];
        int max = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            }
        }
        System.out.println(max);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        // 102B - Maximum Difference

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[n];
        int max = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            }
        }
        System.out.println(max);
    }
} Main public static void main(String[] args) {
        // 102B - Maximum Difference

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[n];
        int max = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            }
        }
        System.out.println(max);
    } main {
        // 102B - Maximum Difference

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[n];
        int max = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            }
        }
        System.out.println(max);
    } 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 int max = 0; max 0 for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = sc.nextInt();
            if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            }
        } {
            a[i] = sc.nextInt();
            if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            }
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            } i > 0 i 0 {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            } for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                } int j = 0; int j = 0; j 0 j < i j i j++ j++ j {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                } {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                } int sa = Math.abs(a[i] - a[j]); sa Math.abs(a[i] - a[j]) Math.abs Math a[i] - a[j] a[i] a i a[j] a j if (max < sa) max = sa; max < sa max sa max = sa max sa System.out.println(max) System.out.println System.out System System.out max String[] args args public class Main {

    public static void main(String[] args) {
        // 102B - Maximum Difference

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[n];
        int max = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            }
        }
        System.out.println(max);
    }
} public class Main {

    public static void main(String[] args) {
        // 102B - Maximum Difference

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[n];
        int max = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            }
        }
        System.out.println(max);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // 102B - Maximum Difference

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] a = new int[n];
        int max = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (i > 0) {
                for (int j = 0; j < i; j++) {
                    int sa = Math.abs(a[i] - a[j]);
                    if (max < sa) max = sa;
                }
            }
        }
        System.out.println(max);
    }
}