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 < n; i++) {
            a[i] = sc.nextInt();
        }

        sc.close();

        int diff = Integer.MIN_VALUE;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            }
        }

        System.out.println(diff);

    }

    private static long gcd(long m, long n) {
        if (m < n)
            return gcd(n, m);
        if (n == 0)
            return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
} 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 < n; i++) {
            a[i] = sc.nextInt();
        }

        sc.close();

        int diff = Integer.MIN_VALUE;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            }
        }

        System.out.println(diff);

    }

    private static long gcd(long m, long n) {
        if (m < n)
            return gcd(n, m);
        if (n == 0)
            return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
} 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 < n; i++) {
            a[i] = sc.nextInt();
        }

        sc.close();

        int diff = Integer.MIN_VALUE;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            }
        }

        System.out.println(diff);

    } main {
        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();
        }

        sc.close();

        int diff = Integer.MIN_VALUE;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            }
        }

        System.out.println(diff);

    } 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 < 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 sc.close() sc.close sc int diff = Integer.MIN_VALUE; diff Integer.MIN_VALUE Integer Integer.MIN_VALUE for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            }
        } {
            for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            }
        } for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            } {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            } int tmp = Math.abs(a[i] - a[j]); tmp Math.abs(a[i] - a[j]) Math.abs Math a[i] - a[j] a[i] a i a[j] a j if (diff < tmp) {
                    diff = tmp;
                } diff < tmp diff tmp {
                    diff = tmp;
                } diff = tmp diff tmp System.out.println(diff) System.out.println System.out System System.out diff String[] args args private static long gcd(long m, long n) {
        if (m < n)
            return gcd(n, m);
        if (n == 0)
            return m;
        return gcd(n, m % n);
    } gcd {
        if (m < n)
            return gcd(n, m);
        if (n == 0)
            return m;
        return gcd(n, m % n);
    } if (m < n)
            return gcd(n, m); m < n m n return gcd(n, m); gcd(n, m) gcd n m if (n == 0)
            return m; n == 0 n 0 return m; m return gcd(n, m % n); gcd(n, m % n) gcd n m % n m n long m m long n n private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    } lcm {
        return m * n / gcd(m, n);
    } return m * n / gcd(m, n); m * n / gcd(m, n) m * n m n gcd(m, n) gcd m n long m m long n n 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 < n; i++) {
            a[i] = sc.nextInt();
        }

        sc.close();

        int diff = Integer.MIN_VALUE;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            }
        }

        System.out.println(diff);

    }

    private static long gcd(long m, long n) {
        if (m < n)
            return gcd(n, m);
        if (n == 0)
            return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
} 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 < n; i++) {
            a[i] = sc.nextInt();
        }

        sc.close();

        int diff = Integer.MIN_VALUE;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            }
        }

        System.out.println(diff);

    }

    private static long gcd(long m, long n) {
        if (m < n)
            return gcd(n, m);
        if (n == 0)
            return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
} 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 < n; i++) {
            a[i] = sc.nextInt();
        }

        sc.close();

        int diff = Integer.MIN_VALUE;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                int tmp = Math.abs(a[i] - a[j]);
                if (diff < tmp) {
                    diff = tmp;
                }
            }
        }

        System.out.println(diff);

    }

    private static long gcd(long m, long n) {
        if (m < n)
            return gcd(n, m);
        if (n == 0)
            return m;
        return gcd(n, m % n);
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }
}