import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int max = 0;
        for (int i = 0; i < A.length; i++) {
            for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            }
        }
        System.out.println(max);
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int max = 0;
        for (int i = 0; i < A.length; i++) {
            for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            }
        }
        System.out.println(max);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int max = 0;
        for (int i = 0; i < A.length; i++) {
            for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            }
        }
        System.out.println(max);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int max = 0;
        for (int i = 0; i < A.length; i++) {
            for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            }
        }
        System.out.println(max);
        sc.close();
    } 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 for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length 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 max = 0; max 0 for (int i = 0; i < A.length; i++) {
            for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            }
        } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
            for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            }
        } {
            for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            }
        } for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j < A.length j A.length A A.length j++ j++ j {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            } {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            } int dif = Math.abs(A[i] - A[j]); dif Math.abs(A[i] - A[j]) Math.abs Math A[i] - A[j] A[i] A i A[j] A j max = Math.max(max, dif) max Math.max(max, dif) Math.max Math max dif System.out.println(max) System.out.println System.out System System.out max sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int max = 0;
        for (int i = 0; i < A.length; i++) {
            for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            }
        }
        System.out.println(max);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int max = 0;
        for (int i = 0; i < A.length; i++) {
            for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            }
        }
        System.out.println(max);
        sc.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int max = 0;
        for (int i = 0; i < A.length; i++) {
            for (int j = i + 1; j < A.length; j++) {
                int dif = Math.abs(A[i] - A[j]);
                max = Math.max(max, dif);
            }
        }
        System.out.println(max);
        sc.close();
    }
}