import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }

            int ans = Integer.MIN_VALUE;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            }

            System.out.println(ans);

        }
    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }

            int ans = Integer.MIN_VALUE;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            }

            System.out.println(ans);

        }
    }

} Main public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }

            int ans = Integer.MIN_VALUE;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            }

            System.out.println(ans);

        }
    } main {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }

            int ans = Integer.MIN_VALUE;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            }

            System.out.println(ans);

        }
    } try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }

            int ans = Integer.MIN_VALUE;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            }

            System.out.println(ans);

        } {
            int n = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }

            int ans = Integer.MIN_VALUE;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            }

            System.out.println(ans);

        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                a[i] = sc.nextInt();
            } {
                a[i] = sc.nextInt();
            } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int ans = Integer.MIN_VALUE; ans Integer.MIN_VALUE Integer Integer.MIN_VALUE for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            } {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            } for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                } int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n j++ j++ j {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                } {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                } int candidate = Math.abs(a[i] - a[j]); candidate Math.abs(a[i] - a[j]) Math.abs Math a[i] - a[j] a[i] a i a[j] a j if (candidate > ans) {
                        ans = candidate;
                    } candidate > ans candidate ans {
                        ans = candidate;
                    } ans = candidate ans candidate 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) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }

            int ans = Integer.MIN_VALUE;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            }

            System.out.println(ans);

        }
    }

} public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }

            int ans = Integer.MIN_VALUE;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            }

            System.out.println(ans);

        }
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }

            int ans = Integer.MIN_VALUE;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            }

            System.out.println(ans);

        }
    }

}
