import 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];
        int max = 0;
        int sabun = 0;

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

        for(int i = 0;i<n-1;i++){
            for(int j = i+1;j<n;j++){
                sabun = Math.abs(a[i]-a[j]);
                if(max<sabun){
                    max = sabun;
                }
            }
        }
        System.out.println(max);

    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int max = 0;
        int sabun = 0;

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

        for(int i = 0;i<n-1;i++){
            for(int j = i+1;j<n;j++){
                sabun = Math.abs(a[i]-a[j]);
                if(max<sabun){
                    max = sabun;
                }
            }
        }
        System.out.println(max);

    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int max = 0;
        int sabun = 0;

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

        for(int i = 0;i<n-1;i++){
            for(int j = i+1;j<n;j++){
                sabun = Math.abs(a[i]-a[j]);
                if(max<sabun){
                    max = sabun;
                }
            }
        }
        System.out.println(max);

    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int max = 0;
        int sabun = 0;

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

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

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

        for(int i = 0;i<n-1;i++){
            for(int j = i+1;j<n;j++){
                sabun = Math.abs(a[i]-a[j]);
                if(max<sabun){
                    max = sabun;
                }
            }
        }
        System.out.println(max);

    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int max = 0;
        int sabun = 0;

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

        for(int i = 0;i<n-1;i++){
            for(int j = i+1;j<n;j++){
                sabun = Math.abs(a[i]-a[j]);
                if(max<sabun){
                    max = sabun;
                }
            }
        }
        System.out.println(max);

    }
} Main
import 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];
        int max = 0;
        int sabun = 0;

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

        for(int i = 0;i<n-1;i++){
            for(int j = i+1;j<n;j++){
                sabun = Math.abs(a[i]-a[j]);
                if(max<sabun){
                    max = sabun;
                }
            }
        }
        System.out.println(max);

    }
}
