import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;

public class aa {

public static void main(String[] args) {

 try{

BufferedReader br = new BufferedReader (new InputStreamReader (System.in));

String input = br.readLine();

int n = Integer.parseInt(input)
;

int [] ar = new int [n]
;

input = br.readLine();

String [] ss ;
ss = input.split(" ")
;

for(int i =0 ; i<n ;i++)
{
    ar[i]= Integer.parseInt(ss[i]);

}

int min = 2000;

int index = 0;

for ( int i = 0 ; i<n-2 ; i++)
{

    if(ar[i+2]-ar[i]<min)
    {

        min = ar[i+2]-ar[i]
;
        index = i;

    }

}

int max = 0;

for (int i=0 ; i< n-1;i++){

    if(ar[i+1]-ar[i]>max&& i+1!= index  && i!=index)
    max = ar[i+1]-ar[i];

}

max = (int)Math.max(min, max);

System.out.println(max);

//System.out.println(Arrays.toString(ar));

 }

    catch(Exception e)
    {

        e.printStackTrace();

    }

}

}

import java.util.Scanner;

public class CF283A {
    public static void main(final 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();
        }

        int res = Integer.MAX_VALUE;
        for (int i = 1; i < n - 1; i++) {
            int curr = -1;
            for (int j = 0; j < n - 1; j++) {
                if (i == j) {
                    continue;
                }

                int next = j + 1 == i ? j + 2 : j + 1;
                if (next < n) {
                    curr = Math.max(curr, a[next] - a[j]);
                }
            }

            res = Math.min(res, curr);
        }

        System.out.println(res);
    }
}

import java.util.Scanner;

public class MinDifficulty {

	private static int max(int a, int b, int c) {
		return (a>b) ?((a>c)? a: c) : (b>c) ? b:c;
	}

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

		int[] diffUponRemoval = new int[holds];
		diffUponRemoval[0] = -1;
		diffUponRemoval[holds-1] = -1;
		for(int i=1; i<holds-1; i++) {
			diffUponRemoval[i] = heights[i+1] - heights[i-1];
		}

		int[] maxDiffLeft = new int[holds];
		maxDiffLeft[0] = -1;
		int maxDiffAtLeft = Integer.MIN_VALUE;
		for(int i=1; i<holds; i++) {
			int m = heights[i] - heights[i-1];
			maxDiffAtLeft = (maxDiffAtLeft > m) ? maxDiffAtLeft : m;
			maxDiffLeft[i] = maxDiffAtLeft;
		}

		int[] maxDiffRight = new int[holds];
		maxDiffRight[holds-1] = -1;
		int maxDiffAtRight = Integer.MIN_VALUE;
		for(int i=holds-2; i>=0; i--) {
			int m = heights[i+1] - heights[i];
			maxDiffAtRight = (maxDiffAtRight > m) ? maxDiffAtRight : m;
			maxDiffRight[i] = maxDiffAtRight;
		}

		int difficulty = Integer.MAX_VALUE;
		for(int i=1; i<holds-1; i++) {
			if(difficulty > max(diffUponRemoval[i], maxDiffRight[i+1], maxDiffLeft[i-1]))
				difficulty =  max(diffUponRemoval[i], maxDiffRight[i+1], maxDiffLeft[i-1]);
		}
		System.out.println(difficulty);

	}
}

import java.util.*;
import java.io.*;
public class R283_2_A {
   public static void main(String[] args) throws Exception {
      // Scanner input = new Scanner(new File("test.in"));
      Scanner in = new Scanner(System.in);
      int n = in.nextInt();
      ArrayList<Integer> list = new ArrayList<Integer>(n);
      for (int i = 0; i < n; i++) {
         list.add(in.nextInt());
      }
      ArrayList<Integer> temp;
      int max, min = 1001;
      for (int i = 1; i < n-1; i++) {
         temp = new ArrayList(list);
         temp.remove(i);
         max = 0;
         for (int j = 0; j < temp.size()-1; j++) {
            max = Math.max(max, temp.get(j+1)-temp.get(j));
         }
         min = Math.min(min, max);
      }
      System.out.println(min);
   } // end main
}

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;

/*
  br = new BufferedReader(new FileReader("input.txt"));
  pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
  br = new BufferedReader(new InputStreamReader(System.in));
  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
	private static BufferedReader br;
	private static StringTokenizer st;
	private static PrintWriter pw;

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		//int qq = 1;
		int qq = Integer.MAX_VALUE;
		//int qq = readInt();
		for(int casenum = 1; casenum <= qq; casenum++) {
			int n = readInt();
			int[] list = new int[n];
			for(int i = 0; i < n; i++) {
				list[i] = readInt();
			}
			int ret = Integer.MAX_VALUE;
			for(int i = 1; i < n-1; i++) {
				ArrayList<Integer> temp = new ArrayList<Integer>();
				for(int a = 0; a < n; a++) {
					if(a==i) continue;
					temp.add(list[a]);
				}
				int worst = 0;
				for(int a = 0; a < temp.size()-1; a++) {
					worst = Math.max(worst, temp.get(a+1) - temp.get(a));
				}
				ret = Math.min(ret, worst);
			}
			pw.println(ret);
		}
		exitImmediately();
	}

	private static void exitImmediately() {
		pw.close();
		System.exit(0);
	}

	private static long readLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private static double readDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	private static int readInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	private static String nextLine() throws IOException  {
		if(!br.ready()) {
			exitImmediately();
		}
		st = null;
		return br.readLine();
	}

	private static String nextToken() throws IOException  {
		while(st == null || !st.hasMoreTokens())  {
			if(!br.ready()) {
				exitImmediately();
			}
			st = new StringTokenizer(br.readLine().trim());
		}
		return st.nextToken();
	}
}

import java.util.*;
public class maximus {
public static void main(String [] args){
  Scanner in=new Scanner(System.in);
  int n=in.nextInt();
  int array[]=new int[n];
  for(int i=0;i<n;i++)array[i]=in.nextInt();
  int temp=0;
  int prev=0;
  int ans=Integer.MAX_VALUE;
  for(int i=1;i<n-1;i++){
  	temp=0;
  	for(int j=0;j<n;j++){
  	if(j==i)continue;
  	temp=Math.max(temp,array[j]-prev);
  	prev=array[j];
  }
  ans=Math.min(ans,temp);
  }
  System.out.print(ans);
    }
}

import java.util.Scanner;
public class Codeforces {

	public static void main(String[] args) {

		Scanner sc= new Scanner(System.in);
		int n=sc.nextInt();
		int[] a= new int[n+1];
		for (int i=1;i<=n;i++) a[i]=sc.nextInt();
		int res=1000;
		for (int i=3;i<=n;i++) res=Math.min(res,a[i]-a[i-2]);
		for (int i=2;i<=n;i++) res=Math.max(res,a[i]-a[i-1]);
		System.out.print(res);
	}

}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Walker
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        String line = in.nextLine();
        String[] parts = line.split(" ");
        int N = Integer.parseInt(parts[0]);
        line = in.nextLine();
        parts = line.split(" ");
        int[] arr = new int[N];
        for(int i = 0; i < N; i++){
            arr[i] = Integer.parseInt(parts[i]);
        }
        int lowest = Integer.MAX_VALUE;
        for(int i = 1; i < N - 1; i++){
            int cost = max_exclude(arr, i);
            if(cost < lowest){
                lowest = cost;
            }
        }
        out.print(lowest);
    }

    public int max_exclude(int[] arr, int exclude){
        int max = 0;
        int cost;
        for(int i = 0; i < arr.length - 1; i++){
            if(i + 1 == exclude){
                cost = arr[i + 2] - arr[i];
                i++;
            }
            else{
                cost = arr[i + 1] - arr[i];
            }
            if(cost > max){
                max = cost;
            }
        }
        return max;
    }
}

import java.awt.font.NumericShaper;
import java.io.InputStreamReader;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;

import javax.naming.BinaryRefAddr;

public class palin {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(System.out);
		Scanner scan = new Scanner(System.in);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {

	public void solve(int testNumber, InputReader in, PrintWriter out) {
		int n = in.nextInt(), a[] = new int[n], d = Integer.MAX_VALUE;
		for (int i = 0; i < a.length; i++) {
			a[i] = in.nextInt();
		}
		for (int i = 1; i < a.length - 1; i++) {
			d = Math.min(d, a[i + 1] - a[i - 1]);
		}
		for (int i = 1; i < a.length; i++) {
			d = Math.max(d, a[i] - a[i - 1]);
		}
		out.print(d);
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public float nextFloat() {
		return Float.parseFloat(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

import java.util.*;
import java.io.*;

public class A {

  static int N;
  static int[] A, oneStepDiff, twoStepDiff;

  private static int returnMinDifficulty() {
    // One step
    oneStepDiff[N-1] = -1;
    int maxOneStep = -1;
    for (int i=0; i<N-1; i++) {
      oneStepDiff[i] = A[i+1] - A[i];
      maxOneStep = Math.max(maxOneStep, oneStepDiff[i]);
    }
    // Two step
    twoStepDiff[N-2] = Integer.MAX_VALUE;
    twoStepDiff[N-1] = Integer.MAX_VALUE;
    int minTwoStep = Integer.MAX_VALUE;
    for (int i=0; i<N-2; i++) {
      twoStepDiff[i] = A[i+2] - A[i];
      minTwoStep = Math.min(minTwoStep, twoStepDiff[i]);
    }
    return Math.max(maxOneStep, minTwoStep);
  }

  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    N = Integer.parseInt(br.readLine());
    A = new int[N];
    String s = br.readLine();
    String[] tokens = s.split(" ");
    for (int i=0; i<N; i++) {
      A[i] = Integer.parseInt(tokens[i]);
    }
    oneStepDiff = new int[N];
    twoStepDiff = new int[N];
    System.out.println(returnMinDifficulty());
  }
}

/*Author LAVLESH*/
import java.util.*;
import java.io.*;
public class solution{
	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st=new StringTokenizer("");
	static public String next() {
	        while (st == null || !st.hasMoreTokens()) {
	            try {
	                st = new StringTokenizer(br.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return st.nextToken();
	    }
	public static void main(String[]args)throws IOException{
		long ans=0;int rd=Integer.MAX_VALUE,min=Integer.MAX_VALUE,max=0;
		PrintWriter op =new PrintWriter(System.out,true);
		int n=Integer.parseInt(next());
	    ArrayList<Integer>a=new ArrayList();
		for(int i=0;i<n;i++)a.add(Integer.parseInt(next()));
		for(int i=2;i<n;i++)
		{
			if(a.get(i)-a.get(i-2)<min){rd=i-1;min=a.get(i)-a.get(i-2);}

		}
		a.remove(rd);
		for(int i=1;i<n-1;i++)
		{
			if(a.get(i)-a.get(i-1)>max)max=a.get(i)-a.get(i-1);

		}
		op.print(max);
		op.close();
  }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

//TODO
public class A496 {

	public static void main(String[] args) throws Exception {
		final FastScanner scanner = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));

		int n = scanner.nextInt();
		int arr[] = new int[n];

		arr = scanner.nextIntArray(n); int ans = Integer.MAX_VALUE;

		for(int skip = 1; skip < n-1; skip++){

			int newSeq[] = new int[n-1];

			int indx = 0;

			for(int j = 0; j < n; j++){
				if(j != skip){
					newSeq[indx++] = arr[j];
				}
			}

			int difficulty = getMaxDifficulty(newSeq);
			if(difficulty < ans){
				ans = difficulty;
			}
		}
		System.out.println(ans);
	}

	private static int getMaxDifficulty(int[] newSeq) {

		int ret = Integer.MIN_VALUE;

		for (int i = 1; i < newSeq.length; i++) {
			final int diff = newSeq[i] - newSeq[i-1];
			if(diff > ret){
				ret = diff;
			}
		}
		return ret;
	}
}

class FastScanner {

    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }

	int[] nextIntArray(int n) throws Exception {
		int[] array = new int[n];
		for (int i = 0; i < n; i++)
			array[i] = nextInt();
		return array;
	}

	long[] nextLongArray(int n) throws Exception {
		long[] array = new long[n];
		for (int i = 0; i < n; i++)
			array[i] = nextLong();
		return array;
	}
}

import java.io.*;
import java.util.*;

public class a
{
	static int[] a;
	static int N;
	public static void main(String[] args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		N=Integer.parseInt(br.readLine());

		a=new int[N];
		st=new StringTokenizer(br.readLine());
		for(int i=0;i<N;i++)
		{
			a[i]=Integer.parseInt(st.nextToken());
		}

		int[] p;
		int[] q;
		int min=Integer.MAX_VALUE;
		for(int i=1;i<N-1;i++)
		{
			p=mk(i);
			q=sum(p);
			min=Math.min(min,mx(q));
		}
		System.out.println(min);
	}

	static int[] sum(int[] aa)
	{
		int n=aa.length;

		int[] ans=new int[n-1];

		for(int i=0;i<n-1;i++)
		{
			ans[i]=aa[i+1]-aa[i];
		}
		return ans;
	}

	static int[] mk(int j)
	{
		int[] ans=new int[N-1];

		for(int i=0;i<j;i++)
		{
			ans[i]=a[i];
		}
		for(int i=j;i<N-1;i++)
		{
			ans[i]=a[i+1];
		}
		return ans;
	}
	static int[] ar(int[] a,int p)
	{
		int n=a.length;
		int[] ans=new int[n-1];
		for(int i=0;i<p-1;i++)
		{
			ans[i]=a[i];
		}
		ans[p]=a[p]+a[p+1];

		for(int i=p+1;i<n-1;i++)
		{
			ans[i]=a[i+1];
		}
		return ans;
	}

	static int mx(int[] a)
	{
		int n=a.length;
		return max(a,0,n-1);
	}
	static int max(int[] a,int i,int j)
	{
		if(i==j)return a[i];

		int mid=(i+j)/2;

		return Math.max(max(a,i,mid),max(a,mid+1,j));
	}
}

import java.io.*;
import java.util.*;
public class difficulty
{
 public static void main(String args[])
 {
  Scanner sc=new Scanner(System.in);
  int i,l,n,nb,s;
  s=l=0;
  String[] x=sc.nextLine().split(" ");
  n=Integer.parseInt(x[0]);
  nb=n-1;
  int[] a=new int[n];
  int[] b=new int[n-1];
  x=sc.nextLine().split(" ");
  for(i=0;i<n;i++)
  a[i]=Integer.parseInt(x[i]);
  for(i=0;i<(n-1);i++)
  b[i]=a[i+1]-a[i];
  for(i=0;i<nb;i++)
  {
   if(b[i]>l)
   l=b[i];
   if(i==1)
   s=b[i]+b[i-1];
   else if(i>1 && (b[i]+b[i-1])<s)
   s=b[i]+b[i-1];
  }
  if(n==3)
  s=a[2]-a[0];
  else if(n==4)
  {
   if(l==b[1])
   s=l+(int)Math.min(b[0],b[2]);
   else
   s=(int)Math.min((b[0]+b[1]),(b[1]+b[2]));
  }
  else if(s<l)
  s=l;
  System.out.println(s);
 }
}

import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Created by Timur on 08.11.2016.
 */
public class _496A_viethoho {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int a[] = new int[n];
        for(int i=0;i<n;i++)
            a[i] = in.nextInt();
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        for(int i=1;i<n;i++)
            max = Math.max(a[i]-a[i-1],max);
        for(int i=0;i+2<n;i++)
            min = Math.min(min,a[i+2]-a[i]);
        System.out.print(Math.max(min,max));
    }
}

import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Created by Timur on 08.11.2016.
 */
public class _496A {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int a[] = new int[n];
        for(int i=0;i<n;i++)
            a[i] = in.nextInt();
        int res = Integer.MAX_VALUE;
        for(int i=1;i<n-1;i++){
            int min = Integer.MIN_VALUE;
            int last = a[0];
            for(int j=1;j<n;j++) {
                if (i == j) continue;
                min = Math.max(min,a[j]-last);
                last = a[j];
            }
            res = Math.min(res,min);
        }
        System.out.print(res);
    }
}

import java.util.Scanner;
import java.lang.Math;

public class MiniDiff {
	public static void main(String args[]) {
		Scanner input = new Scanner(System.in);

		int numHolds = input.nextInt();
		int[] intHolds = new int[numHolds];

		for (int i = 0; i < intHolds.length; i++) {
			intHolds[i] = input.nextInt();
		}
		int min = Integer.MAX_VALUE;
		for (int i = 1; i < intHolds.length - 1; i++) {
			int max = Integer.MIN_VALUE;
			for (int j = 0; j < intHolds.length - 1; j++) {

				int first = j;
				int second = j + 1;
				if (first == i) {
					first++;
				}
				if (second == i) {
					second++;
				}

				int diff = intHolds[second] - intHolds[first];
				max = Math.max(max, diff);
			}
			min = Math.min(max, min);
		}
		System.out.println(min);
	}
}

import java.util.*;
public class Demo {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int[] a=new int[n],b=new int[n-1];
		for(int i=0;i<n;i++){
			a[i]=s.nextInt();
		}
		for(int i=0;i<n-1;i++){
			b[i]=a[i+1]-a[i];
		}
		int m=0;
		for(int i=0;i<n-1;i++){
			m=Math.max(m,b[i]);
		}
		if(n==3)
			System.out.println(b[0]+b[1]);
		else
			System.out.println(Math.max(m,minOfXToY(b)));
    }
	public static int minOfXToY(int[] a){
		int min=a[0]+a[1];
		for(int i=1;i<a.length-1;i++){
			min=Math.min(min,a[i]+a[i+1]);
		}
		return min;
	}
}

import java.util.*;

public class Main {

    public static void main(String[] args) {

      Scanner scn=new Scanner(System.in);
      int n=scn.nextInt();
      int[] arr=new int[n];

      int max=Integer.MIN_VALUE;
      int min=Integer.MAX_VALUE;

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

      for(int i=1;i<n;i++)
       {
         int d=arr[i]-arr[i-1];

         if(d>max)
          {
            max=d;
          }
       }

       for(int i=1;i<n-1;i++)
        {
         int d=arr[i+1]-arr[i-1];

         if(d<min)
          {
           min=d;
          }
        }

       System.out.println(Math.max(min,max));
    }
}

import java.util.*;

/**
 * Created by ReaL PC on 12/12/2016.
 */
public class MinimumDifficulty {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int index = 0;
        Integer min = Integer.MAX_VALUE;
        Integer max = Integer.MIN_VALUE;
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(in.nextInt());
        }
        if (n == 3) {
            System.out.println(list.get(2) - list.get(0));
            return;
        }
        for (int i = 2; i < n - 2; i++) {
            int diff = list.get(i) - list.get(i - 2);
            if (min > diff) {
                min = diff;
                index = i - 1;
            }
        }
        list.remove(index);
        int len = list.size();
        for (int i = 1; i < len; i++) {
            int diff = list.get(i) - list.get(i - 1);
            if (max < diff) {
                max = diff;
            }
        }

        System.out.println(max);
        //System.out.println(min + " " + index + " result = " + max);
        /*for (Integer i : list) {
            System.out.print(i + " ");
        }*/
    }
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class CF_496A {
	static FastScanner sc = new FastScanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new CF_496A().run();
		out.close();
	}

	public void run(){
		int n = sc.nextInt();
		int[] a = sc.readIntArray(n);
		int min = Integer.MAX_VALUE;
		for(int i = 1;i<n-1;i++){
			int max = Integer.MIN_VALUE;
			for(int j = 0;j<n-1;j++){
				if(j == i){
					continue;
				}
				if(j == i-1 && j+2<n){
					max = Math.max(max, a[j+2]-a[j]);
				}else{
					max = Math.max(max, a[j+1]-a[j]);
				}
			}
			min = Math.min(min, max);
		}
		out.println(min);
	}

	static class FastScanner {
		private final InputStream stream;
	    private final byte[] buf = new byte[8192];
	    private int curChar, snumChars;

	    public FastScanner(InputStream st) {
	      this.stream = st;
	    }

	    //读一个字节
	    public int read() {
	      if (snumChars == -1)
	        throw new InputMismatchException();
	      if (curChar >= snumChars) {
	        curChar = 0;
	        try {
	          snumChars = stream.read(buf);
	        } catch (IOException e) {
	          throw new InputMismatchException();
	        }
	        if (snumChars <= 0)
	          return -1;
	      }
	      return buf[curChar++];
	    }

	    public int nextInt() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      int sgn = 1;
	      if (c == '-') {
	        sgn = -1;
	        c = read();
	      }
	      int res = 0;
	      do {
	        res *= 10;
	        res += c - '0';
	        c = read();
	      } while (!isSpaceChar(c));
	      return res * sgn;
	    }

	    public int[] readIntArray(int n) {
	      int a[] = new int[n];
	      for (int i = 0; i < n; i++) {
	        a[i] = nextInt();
	      }
	      return a;
	    }

	    public boolean isSpaceChar(int c) {
	      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	    }
	}
}

import java.io.*;
import java.util.*;

public class Test {
	static BufferedReader reader;
	static StringTokenizer tokenizer;
	static PrintWriter writer;

	static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	static String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

	 static class R implements Comparable<R>{
	        int x, y;
	        public  R(int x, int y) {
	            this.x = x;
	            this.y = y;
	        }
	        public int compareTo(R o) {
            		return x-o.x;     //Increasing order(Which is usually required)
        		}
	    }

	public static void main(String[] args) throws IOException {
		reader = new BufferedReader(new InputStreamReader(System.in));
		tokenizer = null;
		writer = new PrintWriter(System.out);
		solve();
		reader.close();
		writer.close();
	}

	private static void solve() throws IOException {
		int n = nextInt();
		int[] v=new int[n];
		for(int i=0;i<n;i++){
			v[i]=nextInt();
		}
		int mx = -1;
    	for(int i =1; i<n; ++i)
    	{
    		mx = Math.max(mx , v[i] - v[i-1]);
    	}
    	int ans = 1000000009;
    	for(int i =1; i < n-1; ++i)
    	{
    		ans = Math.min(ans , v[i+1] - v[i-1]);
    	}
    	ans = Math.max(ans , mx);
		writer.println(ans);
	}
}

import java.util.*;
import java.io.*;

public class Main {
    public static void main (String[] args) {
        FastScanner scanner = new FastScanner();
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();

        }
        int max =Integer.MIN_VALUE, min = Integer.MAX_VALUE;
        for (int i = 0; i < n - 1; i++) {
            if (a[i + 1] - a[i] > max) max = a[i + 1] - a[i];
        }
        for (int i = 1; i < n - 1; i++) {
            if (a[i + 1] - a[i - 1] < min) min = a[i + 1] - a[i - 1];
        }

        System.out.println(Math.max(max, min));
    }
}

class FastScanner {
    public BufferedReader reader;
    public StringTokenizer tokenizer;
    public FastScanner() {
        reader = new BufferedReader(new InputStreamReader(System.in), 32768);
        tokenizer = null;
    }
    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    public String nextLine() {
        try {
            return reader.readLine();
        } catch(IOException e) {
            throw new RuntimeException(e);
        }
    }
}

/*
 ID: jeromej1
 LANG: JAVA
 PROG: 496A
 */

import java.io.*;
import java.util.*;

public class FourNineSixA
{
	int numHolds;
	int[] holdPoints;

	public FourNineSixA() throws Exception
	{
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
		numHolds = Integer.parseInt(f.readLine());
		holdPoints = new int[numHolds];
		StringTokenizer s = new StringTokenizer(f.readLine());
		for(int i = 0; i < numHolds; i++)
		{
			holdPoints[i] = Integer.parseInt(s.nextToken());
		}
		int min = holdPoints[2] - holdPoints[0];
		int index = 1;
		for(int i = 0; i < numHolds - 2; i++)
		{
			int d = holdPoints[i + 2] - holdPoints[i];
			if(d < min)
			{
				min = d;
				index = i + 1;
			}
		}
		int max = 0;
		for(int i = 1; i < numHolds; i++)
		{
			if(i == index)
			{
				continue;
			}
			else if(i == index + 1)
			{
				int x = holdPoints[i] - holdPoints[i - 2];
				if(x > max)
				{
					max = x;
				}
			}
			else
			{
				int x = holdPoints[i] - holdPoints[i - 1];
				if(x > max)
				{
					max = x;
				}
			}
		}
		System.out.println(max);
	}

	public static void main(String [] args) throws Exception
	{
		FourNineSixA difficulty = new FourNineSixA();
	}
}

import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        for(int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        int res=Integer.MAX_VALUE;
        for(int i=1;i<n-1;i++){
            int diff=Integer.MIN_VALUE;
            for(int j=0;j<n-1;j++){
                if(i==j+1){
                    diff=Math.max(diff,arr[j+2]-arr[j]);
                }
                else {diff=Math.max(diff,arr[j+1]-arr[j]);
            }}

            res=Math.min(res,diff);
        }

    System.out.print(res);
    }}

import java.util.ArrayList;
import java.util.Scanner;

public class A496 {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();

		ArrayList<Integer> ar = new ArrayList();
		for (int i = 0; i < n; i++) {
			ar.add(scan.nextInt());
		}

		int min = Integer.MAX_VALUE;
		int ind = -1;
		for (int i = 0; i < n - 2; i++) {
			int cur = ar.get(i + 2) - ar.get(i);
			if (cur < min) {
				min = cur;
				ind = i + 1;
			}
		}
		ar.remove(ind);

		int ans = -1;
		for (int i = 0; i < ar.size() - 1; i++) {
			int cur = ar.get(i + 1) - ar.get(i);
			if (cur > ans) {
				ans = cur;
			}
		}
		System.out.print(ans);
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class p6 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int arr[] = new int[n];
		int arr1[] = new int[n-1];
		int arr2[] = new int[n-2];
		int arr3[] = new int[n-2];
		for(int i = 0;i<n;i++) {
			arr[i] = sc.nextInt();
		}
		for(int i = 1;i<n-1;i++) {
			int count = 0;
		for(int j = 0;j<n;j++) {
			if(j==i) {
				continue;
			}
			else {
			arr1[count] = arr[j];
			count+=1;
			}
		}
		for(int j = 0;j<n-2;j++) {
			arr2[j] = arr1[j+1]-arr1[j];
		}
		Arrays.sort(arr2);
		arr3[i-1] = arr2[n-3];
		}
		Arrays.sort(arr3);
		System.out.println(arr3[0]);
	}
}

import java.util.*;
import java.io.*;

/*
*/

public class Main{
    public static OutputStream out=new BufferedOutputStream(System.out);

    //nl-->neew line; //l-->line;  //arp-->array print;  //arpnl-->array print new line
    public static void nl(Object o) throws IOException{out.write((o+"\n").getBytes());}
    public static void l(Object o) throws IOException{out.write((o+"").getBytes());}
    public static void arp(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+" ").getBytes());}
    public static void arpnl(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+"\n").getBytes());}
    //
    static int MOD=(int)1e9+7;
    static int[][] pascal_trgl=new int[4005][4005];
    //

    public static void main(String[] args) throws IOException{
        // long sttm=System.currentTimeMillis();
        FastReader sc=new FastReader();
        int n=sc.nextInt();
        int[] a=new int[n];
        int max=0;
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        int ans=Integer.MAX_VALUE;
        for(int i=2;i<n;i++){
            int temp=0;
            for(int j=1;j<n;j++){
                if(j==i){
                    temp=Math.max(temp,a[j]-a[j-2]);
                    continue;
                }
                temp=Math.max(temp,a[j]-a[j-1]);
            }
            ans=Math.min(ans,temp);
        }
        nl(ans);
        out.flush();
    }

    public static int nCr(int n,int r){
        return pascal_trgl[n][r]%MOD;
    }

    public static void intiTriangle(){
        for (int i = 0; i <= 4004; i++) {
			Arrays.fill(pascal_trgl[i], 0);
		}

		pascal_trgl[0][0] = 1;

		for (int i = 1; i <= 4004; i++) {
			pascal_trgl[i][0] = 1;
			for (int j = 1; j <= i; j++) {
				pascal_trgl[i][j] = (pascal_trgl[i - 1][j - 1] + pascal_trgl[i - 1][j]) % MOD;
			}
		}
    }

    public static String decToBin(long val){
        StringBuilder binstr=new StringBuilder();
        while(val>0){
            Long rem=val%2;val/=2;
            binstr.append(Long.toString(rem));
        }
        binstr.reverse();
        return new String(binstr);
    }

    public static long binToDec(String binstr){
        long ans=0;
        long mul=1;int val=0;
        int n=binstr.length();
        for(int i=0;i<n;i++){
            if(binstr.charAt(n-1-i)=='1') val=1;
            ans+=(mul*val);
            val=0;
            mul*=2;
        }
        return ans;
    }

    public static StringBuilder OR(long val1,long val2){
        StringBuilder s=new StringBuilder();
        while(val1>0 || val2>0){
            long rem1=0,rem2=0;
            if(val1>0) rem1=val1%2;
            if(val2>0) rem2=val2%2;
            val1/=2;val2/=2;
            s.append(Long.toString(Math.max(rem1,rem2)));
        }
        s.reverse();
        return s;
    }

    public static boolean dfsCycle(ArrayList<Integer>[] arrl,int[] vis,int st,int pr){
        vis[st]=1;
        int cupr=st;
        for(int elm:arrl[st]){
            if(vis[elm]==1 && elm!=pr){
                return true;
            }
            else if(vis[elm]==0 && dfsCycle(arrl, vis, elm, cupr)){
                return true;
            }
        }
        vis[st]=2;
        return false;
    }

    public static long powMOD(long n,long k){                 //n-pow(k)
        if(k==1){
            return n%MOD;
        }
        if(k==0){
            return 1;
        }
        long val=pow(n,k/2)%MOD;
        if(k%2==0)return ((val%MOD)*(val%MOD))%MOD;
        else return (((val*val)%MOD)*n)%MOD;
    }

    public static long pow(long n,long k){                 //n-pow(k)
        if(k==1){
            return n;
        }
        if(k==0){
            return 1;
        }
        long val=pow(n,k/2);
        if(k%2==0)return ((val)*(val));
        else return (((val*val))*n);
    }

    public static HashMap<Integer,Integer> lcm(int num){
        ArrayList<Integer> arrl=new ArrayList<Integer>();
        HashMap<Integer,Integer> map=new HashMap<Integer,Integer>();
        while(num%2==0){

            if(!map.containsKey(2)){
                arrl.add(2);
                map.put(2, 1);
            }
            else{
                map.put(2,map.get(2)+1);
            }
            num/=2;
        }
        for(int i=3;i*i<=num;i+=2){
            while(num%i==0){
                if(!map.containsKey(i)){
                    arrl.add(i);
                    map.put(i, 1);
                }
                else{
                    map.put(i,map.get(i)+1);
                }
                num/=i;
            }
        }
        if(num>2){
            if(!map.containsKey(num)){
                arrl.add(num);
                map.put(num, 1);
            }
            else{
                map.put(num,map.get(num)+1);
            }
        }
        return map;
    }

    static long m=998244353l;
    static long modInverse(long a,long m)
    {
        long m0 = m;
        long y = 0l, x = 1l;

        if (m == 1)
            return 0l;

        while (a > 1)
        {

            long q = a / m;

            long t = m;

            m = a % m;
            a = t;
            t = y;

            y = x - q * y;
            x = t;
        }
        if (x < 0)
            x += m0;

        return x;
    }

    public static int num_fact(int num){
        ArrayList<Integer> arr=new ArrayList<Integer>();
        int cnt=0;
        for(int i=1;i*i<=num;i++){
            if(num%i==0){
                if(i*i==num){
                    cnt+=1;
                }
                else{
                    cnt+=2;
                }
            }
        }
        return cnt;
    }

    public static void sort_inc(int[][] arr,int col){        //change dimention if req
        Arrays.sort(arr, new Comparator<int[]>() {
            public int compare(final int[] entry1,final int[] entry2) {
                if (entry1[col] < entry2[col])              //this is for dec
                    return 1;
                else if(entry1[col]==entry2[col])
                    return 0;
                else
                    return -1;
            }
        });
    }

    public static boolean prime(int n){
        for(int i=2;i*i<=n;i++){
            if(n%i==0){
                return false;
            }
        }
        return true;
    }

    static long gcd(long a, long b)
	{
	if (b == 0)
		return a;
	return gcd(b, a % b);
    }

    public static long lcmOfTwo(int a,int b){
        return a*b/gcd(a,b);
    }

}

class FastReader{
    BufferedReader br;
    StringTokenizer st;

    public FastReader(){
        br = new BufferedReader(new
                 InputStreamReader(System.in));
    }

    String next(){
        while (st == null || !st.hasMoreElements()){
            try{
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException  e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt(){
        return Integer.parseInt(next());
    }

    long nextLong(){
        return Long.parseLong(next());
    }

    double nextDouble(){
        return Double.parseDouble(next());
    }

    String nextLine(){
        String str = "";
        try{
            str = br.readLine();
        }
        catch (IOException e){
            e.printStackTrace();
        }
        return str;
    }
}

//Pair Task in process

// class Pair<D1,D2> extends Comparable{
//     D1 v1;
//     D2 v2;

//     Pair(D1 a,D2 b){
//         v1=a;v2=b;
//     }
// }

//package javaapplication1;
import java.io.*;
import java.util.*;

public class JavaApplication1 implements Runnable {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");
    final boolean OJ = System.getProperty("ONLINE_JUDGE") != null;

    void init() throws FileNotFoundException {
        if (OJ) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("Input.txt"));
            out = new PrintWriter("Output.txt");
        }
    }

    @Override
    public void run() {
        try {
            init();
            solve();
            out.close();
        } catch(Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    public static void main(String[] args) {
        new Thread(null, new JavaApplication1(), "", (1L << 20) * 256).start();
    }

    String readString() {
        while(!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch(Exception e) {
                e.printStackTrace();
                System.exit(-1);
            }
        }
        return tok.nextToken();
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

////////////////////////////////////////////////////////////////////////////////

    int abs(int x) {
        return Math.abs(x);
    }

    long c(int x) {
        return (long)x * (x - 1) / 2;
    }

    void solve() {
        int n = readInt();
        int mn = Integer.MAX_VALUE;
        int mx = Integer.MIN_VALUE;
        int[] a = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = readInt();
            if (i >= 1) mx = Math.max(mx, a[i] - a[i - 1]);
            if (i >= 2) mn = Math.min(mn, a[i] - a[i - 2]);
        }
        out.println(Math.max(mx, mn));
    }

}//

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

public class B {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        BInputReader in = new BInputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    public void solve(int testNumber, BInputReader in, PrintWriter out) {
        //Read inputs and write the main function.
        int n = in.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++) a[i] = in.nextInt();

        int min = Integer.MAX_VALUE;
        for(int k=1;k<n-1;k++) {
            int max = Integer.MIN_VALUE;
            for(int j=1;j<n;j++) {
                if(j==k) continue;
                else if (j != k+1) max = Math.max(max, a[j] - a[j - 1]);
                else max = Math.max(max,a[j]-a[j-2]);
            }
            min = Math.min(min,max);
        }
        out.println(min);
    }
}

class BInputReader {
    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public BInputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public Long nextLong() {
        return Long.parseLong(next());
    }
}

import java.util.Scanner;

public class find_d {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] ar = new int[n];
        for (int i = 0; i < n; i++) {
            ar[i] = in.nextInt();
        }
        int arr[] = new int[n-2];
        for(int i=1;i<n-1;i++) {
            int d=0;
            for(int j=0;j<n-1;j++) {
                if ((j + 1 != i) && (j != i)) {
                    if (d < ar[j + 1] - ar[j]) d = ar[j + 1] - ar[j];
                } else {
                    if (j + 1 == i) {
                        if (ar[j + 2] - ar[j] > d) d = ar[j + 2] - ar[j];
                    }
                }
            }
            arr[i-1]=d;
        }
        int g = arr[0];
        for(int i =0;i<n-2;i++) {
            if (arr[i]< g) {
                g = arr[i];
            }
        }
        System.out.println(g);
    }
}

import java.io.*;
import java.util.*;
public class A_MinimumDifficulty {
	public static void main(String args[]) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int arr[] = new int[n];
		StringTokenizer st = new StringTokenizer(br.readLine());
		for(int i = 0; i < n; i++){
			arr[i] = Integer.parseInt(st.nextToken());
		}
		boolean flag[] = new boolean[n];
		Arrays.fill(flag, true);
		int min = Integer.MAX_VALUE;
		for(int i = 1; i < arr.length - 1; i++){
			flag[i] = false;
			min = Math.min(min, solve(flag, arr));
			flag[i] = true;
		}
		System.out.println(min);
	}
	public static int solve(boolean[] flag, int[] arr){
		List<Integer> list = new LinkedList<Integer>();
		list.add(arr[0]);
		for(int i = 1; i < arr.length; i++){
			if(flag[i]){
				list.add(arr[i]);
			}
		}
		int max = Integer.MIN_VALUE;
		for(int i = 1; i < list.size(); i++){
			max = Math.max(max, list.get(i) - list.get(i - 1));
			//System.out.println(max);
		}
		//System.out.println();
		return max;
	}
}

import java.io.*;
import java.util.*;
public class escalar{
public static void main(String args[]) throws IOException{
BufferedReader lector = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(lector.readLine());
String aa[] = lector.readLine().split(" ");
int r[] = new int[a];
Vector<p> par = new Vector<p>();
for(int n =0;n<a;n++){
r[n]=Integer.parseInt(aa[n]);
if(n>0)
par.add(new p(r[n]-r[n-1],n));
}
Collections.sort(par);
//System.out.println(par);
int min =Integer.MAX_VALUE;
for(int n =1;n<a-1;n++){
int rr = r[n+1]-r[n-1];
if(n!=par.get(0).b && n+1!=par.get(0).b)
min = Math.min(min,Math.max(rr,par.get(0).a));
else{
if(par.size()>1)
min = Math.min(min,Math.max(rr,par.get(1).a));
else
min = Math.min(min,rr);
}
}
System.out.println(min);
}
}
class p implements Comparable{
int a,b;
public p(int a,int b){
this.a =a;
this.b = b;
}
public int compareTo(Object o){
p pp = (p)o;
return (int)Math.signum(pp.a-a);
}
public String toString(){return a+" "+b;}
}

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int max;int min = 10000;
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = in.nextInt();
        }
        for (int i = 1; i < a.length-1; i++) {
            max = 0;
            for (int j = 0; j < a.length-1; j++) {
                if(j+1==i){
                    max = a[j+2]-a[j]>max?a[j+2]-a[j]:max;
                    j++;
                }
                else{
                    max = a[j+1]-a[j]>max?a[j+1]-a[j]:max;
                }
            }
            min = max<min?max:min;
        }
        System.out.println(min);
    }
}

import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class solver implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
    }

    String readString() {
        try {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return tok.nextToken();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

    long readLong() {
        return Long.parseLong(readString());
    }

    double readDouble() {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Thread(null, new solver(), "", 256 * (1L << 20)).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            init();
            solve();
            out.close();
            // time();
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    void solve() {
        int n = readInt();
        int[] a = new int[n];
        for (int i=0;i<n;i++) {
            a[i] = readInt();
        }
        int left = a[0];
        int ans = Integer.MAX_VALUE;
        for (int i=2;i < n; i++) {
            int max = a[i] - left;
            for (int j=0;j < i - 2; j++) {
                max = Math.max(max, a[j+1] - a[j]);
            }
            for (int j=i;j<n-1;j++) {
                max = Math.max(max, a[j+1] - a[j]);
            }
            ans = Math.min(max,  ans);
            left = a[i-1];
        }
        out.println(ans);
    }
}

import java.util.Scanner;
public class Main {
	public static void main(String args[]){
		Scanner s=new Scanner(System.in);
		int num=s.nextInt();
		int max=0;
		int[] dif=new int[num];
		dif[0]=s.nextInt();
		max=0;
		int sub=0;
		int subL=0;
		int min=Integer.MAX_VALUE;
		for(int i=1;i<num;i++){
			dif[i]=s.nextInt();
			subL=sub;
			sub=dif[i]-dif[i-1];
			if(i>=2){
				if(sub+subL<min)
					min=sub+subL;
			}

			if(sub>max)
				max=sub;
		}
		if(min>max)
			System.out.print(min);
		else
			System.out.print(max);
	}
}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R283_Div2_A
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R283_Div2_A().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		int n = in.nextInt();

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

		int min = a[n-1] - a[0];
		for (int i = 0; i < n-2; i++)
		{
			int max = 0;
			for (int j = 0; j < n-1; j++)
				if (i == j) {
					max = Math.max(max, a[j+2] - a[j]);
					j++;
				}
				else
					max = Math.max(max,  a[j+1] - a[j]);

			min = Math.min(min, max);
		}

		out.println(min);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

import java.util.Scanner;
public class Minimum {

    public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int n=input.nextInt();
int[] a=new int[n];

boolean[] b=new boolean[n];
int test1,test2;
int min,before=0,result=1000;
for(int i=0;i<n;i++){
    a[i]=input.nextInt();
}
for(int i=1;i<n-1;i++){
    min=0;
    for(int j=0;j<n;j++){
        if(j==i)
            continue;
        //System.out.println("i:"+i+"  j:"+j);
        //System.out.println("a[i]:"+a[j]+" before:"+before+" min:"+min);
        min=Math.max(a[j]-before,min);
        before=a[j];
    }
    result=Math.min(result,min);
}

System.out.println(result);
    }

}

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.util.Map;
import java.lang.String;
import java.lang.Math;

public class template {
	public static void main(String[] args) {
	InputStream inputStream = System.in;
	OutputStream outputStream = System.out;
	InputReader in = new InputReader(inputStream);
	PrintWriter out = new PrintWriter(outputStream);
	Task solver = new Task();
	solver.solve(in, out);
	out.close();
	}
}

class Task {
	public void solve(InputReader in, PrintWriter out) {
		int n = in.nextInt();
		int[] stones = new int[n];
		for (int i = 0; i < n; ++i) {
			stones[i] = in.nextInt();
		}
		if (n == 2) {
			out.println(stones[2] - stones[0]);
		}
		int _max = 10000, tmp = 0;
		for (int i = 1; i <= n - 2; ++i) {
			tmp = Math.abs(stones[i-1] - stones[i+1]);
			for (int j = 0; j < n - 1; ++j) {
				if (j == i - 1 || j == i)
					continue;
				tmp = Math.max(tmp, Math.abs(stones[j]-stones[j+1]));
			}
			if (tmp == 9)
				out.println(i + " " + stones[i]);
			_max = Math.min(tmp, _max);
		}
		out.println(_max);
	}
}

class InputReader {
	BufferedReader reader;
	StringTokenizer tokenize;

	InputReader(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenize = null;
	}

	public String next() {
		while (tokenize == null || !tokenize.hasMoreTokens()) {
			try{
				tokenize = new StringTokenizer(reader.readLine());
			}catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenize.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}
}

import java.util.*;
public class Main {
public static void main(String [] args){
  Scanner in=new Scanner(System.in);
  int n=in.nextInt();
  int array[]=new int[n];
  for(int i=0;i<n;i++)array[i]=in.nextInt();
  int temp=0;
  int prev=0;
  int ans=Integer.MAX_VALUE;
  for(int i=1;i<n-1;i++){
  	temp=0;
  	for(int j=0;j<n;j++){
  	if(j==i)continue;
  	temp=Math.max(temp,array[j]-prev);
  	prev=array[j];
  }
  ans=Math.min(ans,temp);
  }
  System.out.print(ans);
    }
}

/**
 * Minimum Difficulty Problem: http://codeforces.com/problemset/problem/496/A
 *
 * @author gaber
 *
 */

import java.util.Arrays;
import java.util.Scanner;

public class A496 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] holds = new int[n];
		for (int i = 0; i < n; i++) {
			holds[i] = in.nextInt();
		}
		int[] difficulties = new int[n - 2];
		for (int i = 1; i < n - 1; i++) {
			int maxDiff = Integer.MIN_VALUE;
			for (int j = 0; j < n - 1; j++) {
				if (j + 1 != i)
					maxDiff = Math.max(maxDiff, holds[j + 1] - holds[j]);
				else
					maxDiff = Math.max(maxDiff, holds[j + 2] - holds[j]);
			}
			difficulties[i - 1] = maxDiff;
		}
		Arrays.sort(difficulties);
		System.out.println(difficulties[0]);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class MinimumDifficulty {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(f.readLine());
		StringTokenizer st = new StringTokenizer(f.readLine());
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(st.nextToken());

		int max = 0;
		for (int i = 0; i < n-1; i++)
			max = Math.max(max, a[i+1] - a[i]);

		int min = Integer.MAX_VALUE;
		for (int i = 1; i < n-1; i++)
			min = Math.min(min, a[i+1] - a[i-1]);

		System.out.println(Math.max(min, max));
	}
}

import java.io.*;
import java.util.*;
public class Main {
   public static void main(String[] args) throws Exception
   {
       Reader.init(System.in);
       int n = Reader.nextInt();
       int a[]=new int[n];
       int b[]=new int [n-2];
       int y=0;
       for (int i = 0; i < a.length; i++)
           a[i]=Reader.nextInt();

       for (int i = 1; i < a.length-1; i++) {
           int s=0;
           for (int j = 0; j < a.length; j++) {
                if(j+1==i)
                {
                 if(j+2<a.length)
                   s=Math.max(s, a[j+2]-a[j]);

                }
                if(j+1<a.length)
                   s=Math.max(s, a[j+1]-a[j]);
           }
          b[y]=s;
           y++;
       }
      Arrays.sort(b);
       System.out.println(b[0]);
   }
}
class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
   static public void nextIntArrays(int[]... arrays) throws IOException {
        for (int i = 1; i < arrays.length; ++i) {
            if (arrays[i].length != arrays[0].length) {
                throw new InputMismatchException("Lengths are different");
            }
        }
        for (int i = 0; i < arrays[0].length; ++i) {
            for (int[] array : arrays) {
                array[i] = nextInt();
            }
        }}
    static public void nextLineArrays(String[]... arrays) throws IOException {
        for (int i = 1; i < arrays.length; ++i) {
            if (arrays[i].length != arrays[0].length) {
                throw new InputMismatchException("Lengths are different");
            }
        }
        for (int i = 0; i < arrays[0].length; ++i) {
            for (String[] array : arrays) {
                array[i] = reader.readLine();
            }
        }}
}

import java.util.*;
public class B {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
int n = reader.nextInt();
ArrayList<Integer> a = new ArrayList<Integer>();
for (int i = 0; i < n; i++) {
a.add(reader.nextInt());
}

ArrayList<Integer> b = new ArrayList<Integer>(a);
ArrayList<Integer> x = new ArrayList<Integer>();
ArrayList<Integer> z = new ArrayList<Integer>();

for (int i = 1; i < n-1; i++) {
b.remove(i);
for (int j = 0; j < b.size()-1 ; j++) {
x.add(b.get(j+1) - b.get(j));
}
Collections.sort(x);
z.add(x.get(x.size() - 1));
x = new ArrayList<Integer>();
b = new ArrayList<Integer>(a);
}
Collections.sort(z);

System.out.println(z.get(0));
}
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.util.Arrays;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class MainA {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
	int n = in.nextInt(); // num holds
	int[] holds = new int[n];
	for (int i = 0; i < n; i++) holds[i] = in.nextInt();
	int maxDifficulty = Integer.MIN_VALUE;
	for (int i = 1; i < n; i++) {
		maxDifficulty = Math.max(maxDifficulty, holds[i] - holds[i-1]);
	}
	int minDifficulty = Integer.MAX_VALUE;
	for (int i = 1; i < n-1; i++) {
		minDifficulty = Math.min(minDifficulty, holds[i+1] - holds[i-1]);
	}
	out.write(Math.max(minDifficulty, maxDifficulty) + "\n");
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.util.*;
public class minimumDifficulty {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n=scn.nextInt();
		int[] array=new int[n];
		for(int i=0;i<n;i++) {
			array[i]=scn.nextInt();
		}
		int[] ans=new int[n-1];
		int max=Integer.MIN_VALUE;
		for(int i=0;i<n-1;i++) {
			ans[i]=array[i+1]-array[i];
			if(ans[i]>max) {
				max=ans[i];
			}
		}
		int m=max;
//		for(int pp:ans) {
//			System.out.print(pp+" ");
//		}
//		System.out.println("***"+max+"****");
		int min=Integer.MAX_VALUE;
		for(int i=0;i<ans.length-1;i++) {
			int diff=ans[i]+ans[i+1];
//			System.out.print(diff+" ");
			if(diff>m)
				max=diff;
			else
				max=m;
			if(max<min)
				min=max;
		}
//		System.out.println();
		System.out.println(min);
	}

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    private static final InputStreamReader standardInput = new InputStreamReader(System.in);
    private static final BufferedReader bufferedReader = new BufferedReader(standardInput);
    private static final Scanner scanner = new Scanner(bufferedReader);

    private static final OutputStreamWriter standardOutput = new OutputStreamWriter(System.out);
    private static final BufferedWriter bufferedWriter = new BufferedWriter(standardOutput);
    private static final PrintWriter printWriter = new PrintWriter(bufferedWriter);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int minDiff = Integer.MAX_VALUE;
        for (int i = 1; i <= n - 2; i++) {
            int d = Integer.MIN_VALUE;
            for (int j = 1; j <= n - 1; j++) {
                if (j < i || j > i + 1)
                    d = Math.max(d, a[j] - a[j - 1]);
                else if (j == i + 1)
                    d = Math.max(d, a[j] - a[j - 2]);
                else
                    d = Math.max(d, a[j + 1] - a[j - 1]);
            }
            minDiff = Math.min(d, minDiff);
        }
        printWriter.println(minDiff);
        printWriter.flush();
        scanner.close();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;

public class problemA{
    public static void main (String args [] ) throws IOException{
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in)) ;
        ArrayList<Integer> num = new ArrayList<Integer >() ;
        ArrayList<Integer> num2 = new ArrayList<Integer >() ;

        ArrayList<Integer> maxdifs= new ArrayList<Integer >() ;
        String input = read.readLine() ;
        int  n = Integer.parseInt(input)  ;
        input= read.readLine() ;
        String[] tmp = input.split(" ") ;
        for (int i=0;i<tmp.length ;i++ ){
            int t = Integer.parseInt(tmp[i]);
            num.add(t);
            num2.add(t);
        }
        for (int i=1;i<n-1;i++ ){
            num.remove(i);
            int maxdifl= 0 ;
            for (int j=1;j<num.size();j++ ){
                int diff = num.get(j)-num.get(j-1);
                maxdifl = Math.max(diff , maxdifl ) ;
            }
            maxdifs.add(maxdifl);
            num.clear();
            for (int j=0;j<n;j++ ){
                num.add(num2.get(j)) ;
            }
        }
        System.out.println(Collections.min(maxdifs));
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author invisible
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        MinimumDifficulty solver = new MinimumDifficulty();
        solver.solve(1, in, out);
        out.close();
    }

    static class MinimumDifficulty {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.readInt();
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.readInt();
            }
            int min = Integer.MAX_VALUE;
            for (int j = 1; j < n - 1; j++) {
                int max = Integer.MIN_VALUE;
                for (int i = 0; i < n - 1; i++) {
                    if (i + 1 != j) {
                        max = Math.max(max, a[i + 1] - a[i]);
                    } else {
                        max = Math.max(max, a[i + 2] - a[i]);
                    }
                }
                //out.printLine(max);
                min = Math.min(min, max);

            }
            out.printLine(min);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

/*
ID: benkhad2
PROG : modular
LANG: JAVA
TASK: Modular Equations
*/
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class minimum {
  public static void main (String [] args) throws IOException {
	Scanner read = new Scanner(System.in);
	int n = Integer.parseInt(read.nextLine());
	String t[] = read.nextLine().split(" ");

	PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("test.out")));

	if(n==3){
		System.out.println(Integer.parseInt(t[n-1])-Integer.parseInt(t[0]));
	}else{
		int d=1000;
		for(int i=1;i<n-1;i++){
			int max=0;
			int j=n-1;
			while(j>0){
				int amax=0;
				if(j==i){
					j-=1;
				}else{
					if(j-1==i){
						amax=Integer.parseInt(t[j])-Integer.parseInt(t[j-2]);
					}else{
						amax=Integer.parseInt(t[j])-Integer.parseInt(t[j-1]);
					}
					j--;
				}
				if(amax>max){
					max=amax;
				}
			}
			if(max<d){
				d=max;
			}
		}
		System.out.println(d);
	}

    System.exit(0);

  }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Harshal Khodifad
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ProblemAMinimumDifficulty solver = new ProblemAMinimumDifficulty();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemAMinimumDifficulty {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();

            ArrayList<Integer> a = new ArrayList<>(n);

            for (int i = 0; i < n; i++) a.add(in.nextInt());

            int min_dis = 1000;
            int dis = 0;

            for (int i = 1; i < n - 1; i++) {
                ArrayList<Integer> b = new ArrayList(a);
                b.remove(i);

                dis = 0;

                for (int j = 0; j < n - 2; j++) {
                    if (dis < (b.get(j + 1) - b.get(j))) dis = b.get(j + 1) - b.get(j);
                }
//            out.println(b + "    "+dis);
                if (dis < min_dis) min_dis = dis;
            }

            out.println(min_dis);
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class MinimumDifficulty {

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine().trim());
        String str[] = br.readLine().trim().split(" ");
        int nums[] = new int[n];
        int dif[] = new int[n-1];
        int max = 0;
        nums[0] = Integer.parseInt(str[0]);
        for(int i=1;i<n;i++) {
            nums[i] = Integer.parseInt(str[i]);
            dif[i-1] = nums[i] - nums[i-1];
            if(dif[i-1]>max)
                max = dif[i-1];
        }
        int min = dif[0]+dif[1];
        for(int i=0;i<n-2;i++) {
            min = Math.min(min, dif[i]+dif[i+1]);
        }

        System.out.println(Math.max(min, max));
    }

}

import java.util.*;
public class hello {
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[105];
		int _max = 0;
		int temp = 0;
		for (int i = 0; i < n; ++i) {
			a[i] = scan.nextInt();
			if (i != 0)
				_max = Math.max(_max, a[i] - a[i - 1]);
		}
		int ans = 100000;
		for (int i = 2; i < n; ++i) {
			temp = a[i] - a[i - 2];
			if (temp >= _max) {
				ans = Math.min(ans, temp);
			} else {
                                ans = Math.min(ans, _max);
}
		}
		System.out.println(ans);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        StringBuilder s=new StringBuilder();
        int n=Reader.nextInt(),arr[]=new int[n],i,j,min=Integer.MAX_VALUE,max;
        for(i=0;i<n;i++) arr[i]=Reader.nextInt();
        for(i=1;i<n-1;i++) {
            max=0;
            for(j=1;j<n;j++)
                if(j==i)
                    max=Math.max(max, arr[j+1]-arr[j-1]);
                else max=Math.max(max, arr[j]-arr[j-1]);
            min=Math.min(min, max);
        }
        s.append(min).append('\n');
        System.out.print(s);
    }

}

class Reader {

    static StringTokenizer tokenizer;
    static BufferedReader reader;

    public static void init(InputStream input) throws UnsupportedEncodingException {
        reader=new BufferedReader(new InputStreamReader(input,"UTF-8"));
        tokenizer=new StringTokenizer("");
    }

    public static String next() throws IOException {
        while(!tokenizer.hasMoreTokens())
            tokenizer=new StringTokenizer(reader.readLine());
        return tokenizer.nextToken();
    }

    public static String nextLine() throws IOException {
        return reader.readLine();
    }

    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}

import java.util.*;
public class a498 {

    static int maxm(int []a,int x)
    {
        int max=a[1]-a[0];
        for (int i = 1; i <x; i++) {
        if(a[i]-a[i-1]>max) max=a[i]-a[i-1];
        }
        return max;
    }
    static int minm(int []a,int x)
    {
        int min=a[0];
        for (int i = 0; i <x; i++) {
        if(a[i]<min) min=a[i];
        }
        return min;
    }

    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int n=cin.nextInt();
        int []a=new int[n];
        int []temp=new int[n-1];
        int []max=new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i]=cin.nextInt();
        }
        for (int i = 1; i <n-1; i++) {
            for (int j = 0; j<i; j++) {
                temp[j]=a[j];
            }
            for (int j = i; j <n-1; j++) {
                temp[j]=a[j+1];
            }
            /*for (int j = 0; j <n-1; j++) {
                System.out.print(temp[j]+" ");
            }
            System.out.println();*/

            if(n==3){System.out.println(temp[1]-temp[0]); return;}

            max[i-1]=maxm(temp,n-1);
            //System.out.println(max[i-1]);
        }
        /*for (int j = 0; j <n-2; j++) {
            System.out.print(max[j]+" ");
        }
        System.out.println();*/
        System.out.println(minm(max,n-2));
        cin.close();
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.StringTokenizer;

import javax.print.attribute.DocAttributeSet;
import javax.print.attribute.HashDocAttributeSet;

import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {

	 public void solve(int testNumber, InputReader in, PrintWriter out) {
       int n = in.nextInt();
       int[] a = in.nextIntegerArray(n);
       int ref = Integer.MAX_VALUE , count = 0;
		for(int i = 1; i < n-1; i++){
			if(a[i+1] - a[i-1] < ref){
				ref =  a[i+1] - a[i-1];
				count = i;
				}
		}
		int ans = a[count+1] - a[count-1];
		for(int i = 1; i < n; i++){
			if( i != count && i-1 !=count && a[i] - a[i-1] > ans)
				ans =  a[i]-a[i-1];
		}
		//out.println(count);

		out.println(ans);
    }
}

         //||||||| comparable pair ||||||||
 class pair implements Comparable<pair>{
	 public long first,second;
	 public pair(){
		 first = second = 0;
	 }
	@Override
	public int compareTo(pair arg0) {
		if(this.first > arg0.first)
			return 1;
		else if(this.first < arg0.first)
			return -1;
		else if(this.second > arg0.second)
			return 1;
		else if(this.second < arg0.second)
		     return -1;
		return 0;
	}
 }

   // ||||||| INPUT READER ||||||||
class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public Integer nextInt() {
        return Integer.parseInt(next());
    }

    public Long nextLong() {
    	return Long.parseLong(next());
    }

    public Double nextDouble() {
    	return Double.parseDouble(next());
    }

    public Float nextFloat() {
    	return Float.parseFloat(next());
    }

    public BigInteger nextBigInteger() {
    	return new BigInteger(next());
    }

    public String nextLine() {
    	try {
			return reader.readLine();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}

    }

    public int[] nextIntegerArray(int n) {
    	int[] a = new int[n];
    	for(int i = 0; i <  n; i++)
    		a[i] = nextInt();

    	return a;
    }

    public Long[] nextLongArray(int n) {
    	Long[] a = new Long[n];
    	for(int i = 0; i <  n; i++)
    		a[i] = nextLong();

    	return a;
    }

    public long[] nextlongArray(int n) {
    	long[] a = new long[n];
    	for(int i = 0; i <  n; i++)
    		a[i] = nextLong();

    	return a;
    }

    public double[] nextdoubleArray(int n) {
    	double[] a = new double[n];
    	for(int i = 0; i <  n; i++)
    		a[i] = nextDouble();

    	return a;
    }

    public String[] nextStringArray(int n){
    	String[] s = new String[n];
    	for(int i = 0; i < n; i++)
    		s[i] = next();
    	return s;
    }

    public String[] nextLineStringArray(int n){
    	String[] s = new String[n];
    	for(int i = 0; i < n; i++)
    		s[i] = next();
    	return s;
    }

    }

import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) a[i] = sc.nextInt();
		int sub = 1000;
		for (int i = 1; i < n - 1; i++) {
			int max = 0;
			for (int j = 1; j < n - 1; j++) {
				if (j == i) max = Math.max(max, a[j + 1] - a[j - 1]);
				else        max = Math.max(max, a[j + 1] - a[j]);
			}
			sub = Math.min(sub, max);
		}
		System.out.println(sub);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

import java.io.*;
import java.math.*;
import java.util.*;

public class A {

	public static void main(String[] agrs) {
		FastScanner sc = new FastScanner();
//		int yo = sc.nextInt();
//		while(yo-->0) {
		int n = sc.nextInt();
		int[] a = sc.readArray(n);
		int min = Integer.MAX_VALUE;

		for(int i = 1; i < n-1; i++) {
			List<Integer> list = new ArrayList<>();
			for(int j = 0; j < n; j++) {
				if(j == i) {
					continue;
				}
				list.add(a[j]);
			}
			int tempMax = diff(list);
			min = Math.min(tempMax, min);
		}
		System.out.println(min);

//		}
	}

	static int diff(List<Integer> list) {
		int diff = Integer.MIN_VALUE;
		for(int i = 0; i < list.size()-1; i++) {
			int max = list.get(i+1)-list.get(i);
			diff = Math.max(max, diff);
		}
		return diff;
	}

	static int mod = 1000000007;
	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}

import java.io.*;
import java.util.*;
public class Main
{
	final int inf=(int)(1e9+1);
	private void solve()throws IOException
	{
		int n=nextInt();
		int a[]=new int[n+1];
		a[1]=nextInt();
		int max=0;
		for(int i=2;i<=n;i++)
		{
			a[i]=nextInt();
			max=Math.max(a[i]-a[i-1],max);
		}
		int min=inf;
		for(int i=2;i<n;i++)
		{
			int change=a[i+1]-a[i-1];
			min=Math.min(min,Math.max(max,change));
		}
		out.println(min);
	}

	///////////////////////////////////////////////////////////

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();

		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

import java.io.*;
import java.util.*;

public class MinimumDifficulty {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int x[] = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = in.nextInt();
        }
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n - 2; i++) {
            min = Math.min(min, x[i + 2] - x[i]);
        }
        for (int i = 1; i < n; i++) {
            max = Math.max(x[i] - x[i - 1], max);
        }
        System.out.println(Math.max(max, min));
    }
}

/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.*;
public class Main
{
	public static void main(String[] args) {

	    Scanner sc=new Scanner(System.in);

	    int n=sc.nextInt();
	    int arr[]=new int[101];
	    int i;
	    for(i=1;i<=n;i++)
	    {
	        arr[i]=sc.nextInt();
	    }
	    int diff=0;
	    int min=10000;
	    int j;
	    int max;
	    int temp;
	    for(i=2;i<=n-1;i++)
	    {
	        max=0;
	    for(j=1;j<n;j++)
	    {
	        if(j+1==i)
	        diff=arr[j+2]-arr[j];
	        else if(j==i)
            continue;
            else
           diff=arr[j+1]-arr[j];

	        if(diff>max)
	        max=diff;
	    }
	    if(max<min)
	    min=max;
	    }
	    System.out.println(min);
	     sc.close();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;

/**
 *
ttyohhieneesiaabss
1    23     4

tty
hho
ien
see
iaa
bss

535456
535488
835456
 *
 *
 *
4
aaabbbccc
aaabb
aa2222e
aa21111

1 8 9 10 11

1 9 10 11
1 8 10 11
1 8 9 11
 * */
public class Main
{
    public static void main(String[]arg) throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int i,n,max,min,j;
        n = Integer.parseInt(in.readLine());
        int[]a = new int[n];
        ArrayList<Integer> list;
        StringTokenizer st = new StringTokenizer(in.readLine());
        for(i = 0; i < n; i++)
        {
            a[i] = Integer.parseInt(st.nextToken());
        }
        if(n == 3)
        {
            System.out.println(a[2] - a[0]);
        }
        else
        {
            min = Integer.MAX_VALUE;
            for(i = 1; i < n - 1; i++)
            {
                list = new ArrayList<Integer>();
                list.add(a[0]);
                for(j = 1; j < n - 1; j++)
                {
                    if(i != j)
                    {
                        list.add(a[j]);
                    }
                }
                list.add(a[n-1]);
                //System.out.println(list.toString());
                max = 0;
                for(j = 1; j < list.size(); j++)
                {
                    max = Math.max(list.get(j) - list.get(j-1), max);
                }
                min = Math.min(max, min);
            }
            System.out.println(min);
        }
    }
}

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];

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

        int[] difficulty = new int[n-2];

        for(int i=1; i<n-1; i++) {

            int max = Integer.MIN_VALUE;

            for(int j=1; j<n; j++) {

                int dif;

                if(j==i) {
                    dif = a[j+1] - a[j-1];
                }
                else {
                    dif = a[j] - a[j-1];
                }
                if(dif > max) {
                    max = dif;
                }
            }
            difficulty[i-1] = max;
        }

        Arrays.sort(difficulty);

        System.out.println(difficulty[0]);
    }

}

import java.util.*;
public class MinimumDifficulty {
    public static void main(String[]args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int arr[] = new int[n];
        for(int i=0;i<n;i++){
            arr[i]=in.nextInt();
        }

        int mn = 100000000 , mx = 0;
        for(int i=1;i<n;i++){
            mx = Math.max(mx, arr[i] - arr[i-1]);
            if(i > 1){
                mn = Math.min(mn, arr[i] - arr[i-2]);
            }
        }
        System.out.print(Math.max(mn , mx));
    }
}

import java.io.*;
import java.util.*;

public class solution {
    public static void merge(long arr[], int l, int m, int r) {
        int n1 = m - l + 1;
        int n2 = r - m;
        long L[] = new long[n1];
        long R[] = new long[n2];
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];

        int i = 0, j = 0;

        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }

        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    public static void sort(long arr[], int l, int r) {
        if (l < r) {
            int m = (l + r) / 2;

            sort(arr, l, m);
            sort(arr, m + 1, r);

            merge(arr, l, m, r);
        }
    }

    public static boolean check(int n) {
        String s = "";
        s += n;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) != '4' && s.charAt(i) != '7') {
                return false;
            }
        }
        return true;
    }

    public static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    public static long findTrailingZeros(long n) {
        // Initialize result
        long count = 0;

        // Keep dividing n by powers
        // of 5 and update count
        for (long i = 5; n / i >= 1; i *= 5)
            count += n / i;

        return count;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int a[] = new int[n];
        StringTokenizer st = new StringTokenizer(br.readLine());
        for(int i=0;i<n;i++){
            a[i] = Integer.parseInt(st.nextToken());
        }
        int min = Integer.MAX_VALUE;
        for(int i=1;i<n-1;i++){
            int max = Integer.MIN_VALUE;
            for(int j=0;j<n-1;j++){
                int diff = 0;
                if(i == j)continue;
                else if(j+1 == i){
                    diff = a[j+2]-a[j];
                }
                else{
                    diff = a[j+1]-a[j];
                }
                max = Math.max(max,diff);
            }
            min = Math.min(max,min);
        }
        System.out.println(min);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Comparator;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int n=in.nextInt();
        int arr[]=new int[n];
        for(int i=0;i<n;i++)
            arr[i]=in.nextInt();

        int ind=1,min=(arr[2]-arr[0]);
        for(int i=1;i<n-1;i++)
            if(arr[i+1]-arr[i-1]<min){
                min=arr[i+1]-arr[i-1];
                ind=i;
            }

        int arrn[]=new int[n-1];
        for(int i=0,j=0;i<n-1;i++,j++){
            if(i==ind)
                j++;
            arrn[i]=arr[j];
        }

        min=arrn[1]-arrn[0];
        for(int i=1;i<n-1;i++)
            if(arrn[i]-arrn[i-1]>min){
                min=arrn[i]-arrn[i-1];
            }

        out.print(min);

        out.close();
    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.PrintWriter;
import java.util.Scanner;

public class Solution {
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);

        int n = sc.nextInt();
        int a[] = new int[n];
        for (int i = 0; i<n; i++) {
            a[i] = sc.nextInt();
        }
        int k = 2, min = 100000;
        for (int i = 2; i<n; i++) {
            if (a[i] - a[i-2] < min) {
                min = a[i] - a[i-2];
                k = i-1;
            }
        }
        for (int i = 1; i<n; i++) {
            int s = a[i]-a[i-1];
            if (i==k) {
                s = a[i+1]-a[i-1];
            } else if (i-1==k) {
                s = a[i]-a[i-2];
            }
            if (s>min)
                min = s;
        }
        pw.println(min);
        pw.close();
    }
}

import java.util.*;

public class Rock {
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    int[] track = new int[n];
    for (int i = 0; i < n; i++) {
      track[i] = input.nextInt();
    }

    int minDifficulty = Integer.MAX_VALUE;
    for (int i = 1; i < n-1; i++) {
      int difficulty = 0;
      for (int j = 0; j < n-1; j++) {
        if (i == j+1)
          difficulty = Math.max(difficulty, track[j+2] - track[j]);
        else
          difficulty = Math.max(difficulty, track[j+1] - track[j]);
      }
      minDifficulty = Math.min(minDifficulty, difficulty);
    }

    System.out.println(minDifficulty);
  }
}

import java.util.*;
import java.io.*;
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 min=Integer.MAX_VALUE;
         int min2=Integer.MIN_VALUE;

         for(int i=0;i<n;i++)
           a[i]=sc.nextInt();
         for(int i=1;i<n-1;i++)
            {
              int pre=a[i-1];
              int post=a[i+1];
              min=Math.min(post-pre,min);
              min2=Math.max(a[i]-a[i-1],min2);
            }
         min2=Math.max(min2,a[n-1]-a[n-2]);
         System.out.println(Math.max(min,min2));
     }
}

import java.util.Scanner;
public class MinimumDifficulty {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int min=999999999,max=0;
		int n=sc.nextInt();
		int[] arr=new int[n];
		int[] temp=new int[n-1];
		for(int i=0;i<n;i++) {
			arr[i]=sc.nextInt();
		}
		for(int k=1;k<n-1;k++) {
			for(int i=0;i<n-1;i++) {
				if(i>=k )
					temp[i]=arr[i+1];
				else
					temp[i]=arr[i];
			}
			max=-999999999;
			for(int i=0;i<n-2;i++) {
				if(temp[i+1]-temp[i]>max)
					max=temp[i+1]-temp[i];
			}
			if(min>max)
				min=max;
		}
		System.out.println(min);
		sc.close();
	}
}

import java.util.Arrays;
import java.util.Scanner;
public class T3{

	/*boolean isSubstring(String s1,String s2){
		int j=0;
		int i=0;
			while(j<s1.length() && i<s2.length()){
				if(s2.charAt(i) == s1.charAt(j)){
					i++;
				}
				j++;
				}
			if(i == s2.length()){
		return true;
			}
			return false;
	}*/

public static void main(String[] args) {
Scanner g = new Scanner(System.in);
T3 t = new T3();
//String r = g.next();
//long r1 = g.nextLong();
int r2 = g.nextInt();
/*int r3 = g.nextInt();
int r4 = g.nextInt();
int r5 = g.nextInt();
int r6 = g.nextInt();
int r7 = g.nextInt();*/
long[] a = new long[r2];
long[] a2 = new long[r2-1];
//String s = "";
//double d=0;
//int p=r.length();
//int d,b;
//d=b=0;

int k=0;
boolean b = true;
//boolean f = true;
//String[] ro = new String[r];
		//int[] c = new int[r1];
int max=0;
int min=0;

for(int i=0;i<r2;i++){
	a[i] = g.nextLong();
	if(i>0){
		if(min<a[i]-a[i-1]){
		min = (int) (a[i]-a[i-1]);
		}
	}
	}

//Arrays.sort(a);
max = (int) (a[2]-a[0]);
	for(int i=1;i<r2-1;i++){

	if(max>(int)a[i+1] - a[i-1]){
		max = (int) (a[i+1] - a[i-1]);
	}
	}
	System.out.println(Math.max(max, min));

/*for(int i=0;i<r;i++){
	for(int j=0;j<r;j++){
		if(r3[i] == r1[j])
	r4[i] = r4[i] +1;
}*/
}
}

//package active;

import java.util.Scanner;

public class MinimumDifficulty {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int n = sc.nextInt();
        int[] heights = new int[n];
        int maxDifficulty = -1;

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

        int current;
        int next;
        int diff;
        int elementToRemove;
        int newDifficulty = 1000;
        for (int i = 1; i < n - 1; i++) {
            elementToRemove = heights[i];
            maxDifficulty = -1;
            for (int j = 0; j < n - 1; j++) {
                if (heights[j] == elementToRemove) {
                    current = heights[j - 1];
                } else {
                    current = heights[j];
                }
                if (heights[j + 1] == elementToRemove) {
                    next = heights[j + 2];
                } else  {
                    next = heights[j + 1];
                }
                diff = next - current;
                if (diff > maxDifficulty) {
                    maxDifficulty = diff;
                }
                if (j == n - 2) {
                    if (maxDifficulty < newDifficulty) {
                        newDifficulty = maxDifficulty;
                    }
                }
            }
        }

        System.out.println(newDifficulty);
    }
}

import java.io.IOException;
import java.util.InputMismatchException;

public class Main {
    public static void main(String[] args) {
        FasterScanner s = new FasterScanner();

        long n=s.nextLong();
        long a[]=s.nextLongArray((int)n);
        long ans1=0,ans2=99999999999l;
        for(int i=0;i<n-1;i++)
        {
            ans1=Math.max(ans1, a[i+1]-a[i]);
        }
        for(int i=1;i<n-1;i++)
        {
            ans2=Math.min(ans2, a[i+1]-a[i-1]);
        }
        System.out.println(Math.max(ans1,ans2));
       }

    public static class FasterScanner {
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = System.in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
    }
}

import java.io.*;
import java.util.*;

public class Numbers
{
      public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());

            int minDifficulty = -1, difficulty = -1;
            int n = Integer.parseInt(st.nextToken());
            int[] rock = new int[n];
            st = new StringTokenizer(br.readLine());
            for(int i=0; i<n; i++)
                  rock[i] = Integer.parseInt(st.nextToken());

            for(int i=1; i<n-1; i++)
            {
                for(int j=0; j<n-1;)
                {

                    if(j+1 == i)
                    {
                        difficulty = Math.max(Math.abs(rock[j] - rock[j+2]),difficulty);
                        j += 2;
                    }
                    else
                    {
                        difficulty = Math.max(Math.abs(rock[j] - rock[j+1]),difficulty);
                        j++;
                    }
                }
                  if(i == 1) minDifficulty = difficulty;
                  else minDifficulty = Math.min(difficulty,minDifficulty);
                  difficulty = -1;
            }
            System.out.println(minDifficulty);
	}
}

import java.util.*;
public class codeforces {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		int[] num=new int[n];
		for(int i=0;i<n;i++) {
			num[i]=in.nextInt();
		}
		int maxdiff=0;
		for(int i=0;i<n-1;i++) {
			if(num[i+1]-num[i]>maxdiff)maxdiff=num[i+1]-num[i];
		}
		//System.out.println(maxdiff);
		int result=num[2]-num[0];
		for(int i=1;i<n-1;i++) {
			if(num[i+1]-num[i-1]<=maxdiff) {
				result=maxdiff;break;
			}
			else {
				//System.out.println("ipog");
				//System.out.println(num[i+1]-num[i-1]);
				if(num[i+1]-num[i-1]<result) {
					result=num[i+1]-num[i-1];//System.out.println("rbrbvsv");
					}
			}
		}
		System.out.println(result);
	}
}

import java.util.Arrays;
import java.util.Scanner;
public class A_MinimumDifficulty {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int num = in.nextInt();
        int arr [] = new int [num];
        for(int i = 0 ; i < num ; i++)
        {
            arr[i] = in.nextInt();
        }
        int count = 0 ;
        int res = arr[num-1] - arr[0];
        int tempArr [] = new int [num-1];
        int rakm = 0 ;
        boolean st =false;
        for(int j = 0 ; j < num-2 ;j++ ) {
            rakm++;
            st =false;
            for(int k = 0 ;k < num-1 ;k++){
                if(rakm == k) {
                    tempArr[k] = arr[k+1];
                           st  = true ;
                }else if(st)
                    tempArr[k] = arr[k+1];
                else
                    tempArr[k] = arr[k];
            }
            int temp = 0;
            for (int i = 0; i+1 < num - 1; i++) {
                if ((tempArr[i + 1] - tempArr[i]) > temp)
                    temp = tempArr[i + 1] - tempArr[i];
            }
            if (res > temp)
                res = temp;
        }
        System.out.println(res);
    }
}

import java.io.*;
import java.util.*;
public class Main {

    public static void main(String[] args) throws Exception {
        Reader.init(System.in);
        int n = Reader.nextInt();
        ArrayList<Integer> a = new ArrayList<Integer> () ;
        for (int i=0 ; i<n ; i++)
            a.add(Reader.nextInt());
        ArrayList<Integer> min = new ArrayList<Integer> () ;
        ArrayList<Integer> aa = new ArrayList<Integer> () ;
        int max = 0 ;
        int temp = 0 ;
        for (int i=1 ; i<a.size()-1 ; i++  )
        {
            if (i<a.size()-1)
            {
               max=i ;
               temp = a.get(i);
               a.remove(i);
               for (int j=0 ; j<a.size()-1; j++)
               {
                   min.add(Math.abs(a.get(j)-a.get(j+1)));
               }
               aa.add(Collections.max(min));
               min.clear();
            }
            a.add(max, temp);
        }
        System.out.println(Collections.min(aa));

    }
}

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static byte nextByte() throws IOException {
        return Byte.parseByte(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}

import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int n,min,minI,diff,res;
		ArrayList<Integer> nums = new ArrayList<Integer>();
		n = reader.nextInt();
		min = 4325236;
		minI =0;
		diff = 0;
		res =0;
		for(int i=0;i<n;i++){
			int num = reader.nextInt();
			nums.add(num);
		}
		for(int i=1;i<nums.size()-1;i++){
			diff = nums.get(i+1)-nums.get(i-1);
			if(diff < min) {
				min = diff;
				minI=i;
			}

		}
		res = nums.get(minI+1)-nums.get(minI-1);
		for(int i=1;i<nums.size();i++){
			if(i!=minI){
				diff = nums.get(i) - nums.get(i-1);
				if(diff > res) res = diff;
			}
		}
		System.out.println(res);
	}

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class MinimumDifficulty {

    static class FastScanner{
        BufferedReader s;
        StringTokenizer st;

        public FastScanner(){
            st = new StringTokenizer("");
            s = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastScanner(File f) throws FileNotFoundException{
            st = new StringTokenizer("");
            s = new BufferedReader (new FileReader(f));
        }

        public int nextInt() throws IOException{
            if(st.hasMoreTokens())
                return Integer.parseInt(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextInt();
            }
        }

      public double nextDouble() throws IOException{
            if(st.hasMoreTokens())
                return Double.parseDouble(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextDouble();
            }
        }

        public long nextLong() throws IOException{
            if(st.hasMoreTokens())
                return Long.parseLong(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextLong();
            }
        }

        public String nextString() throws IOException{
            if(st.hasMoreTokens())
                return st.nextToken();
            else{
                st = new StringTokenizer(s.readLine());
                return nextString();
            }

        }
        public String readLine() throws IOException{
            return s.readLine();
        }

        public void close() throws IOException{
            s.close();
        }

    }
      private static FastScanner s = new FastScanner();
      private static PrintWriter ww = new PrintWriter(new OutputStreamWriter(System.out));

      static int count,sum,sum2,count2,temp=1,temp1,temp2=1;
     public static void main(String[] args) throws IOException
     {
         int n,j;
         int []a;
         n=s.nextInt();
         a=new int[n];
         for(int i=0;i<n;i++)
         {
             a[i]=s.nextInt();
         }
         for(int i=1;i<n-1;i++)
         {
                 temp=a[i+1]-a[i-1];
                 if(sum>temp&&i!=1)
                 sum=temp;
                 if(i==1)
                     sum=temp;
                 if(temp==sum)
                     temp1=i;
         }
       // ww.println("small=\t"+temp1);
         sum=0;
         if(temp1!=n-2)
         sum=a[n-1]-a[n-2];
         for(int i=1;i<n-1;i++)
         {
             if(i==temp1)
             {
                 temp=a[i+1]-a[i-1];
                 i=i+1;
             }
             else
                 temp=a[i]-a[i-1];
             if(sum<temp)
                 sum=temp;
         }
         ww.println(sum);
         ww.close();
         s.close();
     }
}

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.lang.*;
import java.util.*;
import java.math.*;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.lang.String;

public class Solution {

    public static void main(String[] args) {
        new Solution().myRun();
    }

    FastInputScanner in;
    PrintWriter out;

    void solveTask() {
        int n = in.nextInt();
        int [] a = new int [n];
        a = in.nextIntArray(n);
        int answer = (int)(1e9);
        for (int i = 1; i + 1 < n; ++i) {
            ArrayList<Integer> myList = new ArrayList<Integer>();
            for (int j = 0; j < n; ++j) {
                if (i != j) {
                    myList.add(a[j]);
                }
            }
            int currentAnswer = 0;
            for (int j = 1; j < myList.size(); ++j) {
                if (myList.get(j) - myList.get(j - 1) > currentAnswer) {
                    currentAnswer = myList.get(j) - myList.get(j - 1);
                }
            }
            if (currentAnswer < answer) {
                answer = currentAnswer;
            }
        }
        out.println(answer);
    }

    void myRun() {
        in = new FastInputScanner(System.in);
        out = new PrintWriter(new OutputStreamWriter(System.out));
        solveTask();
        out.close();
    }

    void myRunIO(){
        try  {
            in = new FastInputScanner(new File("input.txt"));
            out = new PrintWriter(new FileWriter(new File("output.txt")));
            solveTask();
            out.close();
        } catch(Exception exception){
            exception.printStackTrace();
        }
    }

    class FastInputScanner{

        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        public FastInputScanner(File file){
            try{
                bufferedReader = new BufferedReader(new FileReader(file));
            }
            catch(IOException exception){
                exception.printStackTrace();
            }
        }

        public FastInputScanner(InputStream inputStream){
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream), 32768);
        }

        String next(){
            while(stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch(IOException exception) {
                    exception.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        int nextInt(){
            return Integer.parseInt(next());
        }

        double nextDouble(){
            return Double.parseDouble(next());
        }

        float nextFloat(){
            return Float.parseFloat(next());
        }

        String nextLine(){
            try {
                return bufferedReader.readLine();
            }
            catch(Exception exception) {
                exception.printStackTrace();
            }
            return "";
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }

        int[] nextIntArray(int n) {
            int a[] = new int[n];
            for(int i = 0; i < n; i++)
                a[i] = Integer.parseInt(next());
            return a;
        }

        long[] nextLongArray(int n){
            long a[] = new long [n];
            for(int i = 0; i < n; i++)
                a[i] = Long.parseLong(next());
            return a;
        }

        double[] nextDoubleArray(int n){
            double a[] = new double [n];
            for(int i = 0; i < n; i++)
                a[i] = Double.parseDouble(next());
            return a;
        }
    }

}

import java.util.Scanner;

public class contest17 {
    public static void main(String[] args) {
        try
        {
            Scanner s=new Scanner(System.in);
            int n=s.nextInt();
            int ans=0,min=0;
            int b[]=new int[n];
            int a[]=new int[n];
            for(int i=0;i<n;i++)
            {
                a[i]=s.nextInt();
            }
            min=a[2]-a[0];
            for(int i=0;i<n-2;i++)
            {
                b[i]=a[i+2]-a[i];
                if(b[i]<min)
                    min=b[i];
            }

            for(int i=0;i<n;i++)
            {
                if(b[i]==min)
                {
                    ans=i+1;
                }
            }
            for(int i=0;i<ans;i++)
            {
                    b[i]=a[i];
            }
            for(int i=ans+1;i<n;i++)
            {
                b[i-1]=a[i];
            }
            min=0;
            for(int i=0;i<n-1;i++)
            {
                if(b[i+1]-b[i]>min)
                {
                    min=b[i+1]-b[i];
                }
            }
            System.out.println(min);
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    }

}

import java.util.Scanner;
public class A {
 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();
	    }
	    long max=0,min=1000000000;
	  for(int k=1;k<=n-2;k++){ max=0;
		   for(int i=0;i<=n-2;i++){
			   if(i!=k && i+1!=k){
				    if(a[i+1]-a[i]>max) max=a[i+1]-a[i];
			   }
			   else if(i!=k && i+1==k){
				       if(a[i+2]-a[i]>max) max=a[i+2]-a[i];
			   }

			}

		   if(max<min) min=max;
	  }
	  System.out.println(min);

 }
	}

import java.util.*;
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner in=new Scanner(System.in);
	    int n=in.nextInt();
	    int a[]=new int[n];
	    int max=0,min=0;
	    for(int i=0;i<n;i++)
	        a[i]=in.nextInt();
	    for(int i=1;i<n;i++){
	        int diff=a[i]-a[i-1];
	        if(diff>max)
	            max=diff;
	    }
	    min=a[2]-a[0];
	    for(int i=2;i<n-1;i++){
	        int diff=a[i+1]-a[i-1];
	        if(diff<min)
	            min=diff;
	    }
	    System.out.println(Math.max(max,min));
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	final int MOD = 1000000007;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		int n = sc.nextInt();
		int[] a = sc.nextIntArray(n);
		int sub = Integer.MAX_VALUE;
		for (int i = 1; i < n - 1; i++) {
			int max = 0;
			for (int j = 1; j < n; j++) {
				if (j == i) {
					max = Math.max(max, a[j + 1] - a[j - 1]);
					j++;
				} else {
					max = Math.max(max, a[j] - a[j - 1]);
				}
			}
			sub = Math.min(sub, max);
		}
		System.out.println(sub);
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	boolean inner(int h, int w, int limH, int limW) {
		return 0 <= h && h < limH && 0 <= w && w < limW;
	}

	void swap(int[] x, int a, int b) {
		int tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

	// find minimum i (a[i] >= border)
	int lower_bound(int a[], int border) {
		int l = -1;
		int r = a.length;

		while (r - l > 1) {
			int mid = (l + r) / 2;
			if (border <= a[mid]) {
				r = mid;
			} else {
				l = mid;
			}
		}
		// r = l + 1
		return r;
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}

		int[] nextIntArray(int n) {
			int[] in = new int[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextInt();
			}
			return in;
		}

		int[][] nextInt2dArray(int n, int m) {
			int[][] in = new int[n][m];
			for (int i = 0; i < n; i++) {
				in[i] = nextIntArray(m);
			}
			return in;
		}

		double[] nextDoubleArray(int n) {
			double[] in = new double[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextDouble();
			}
			return in;
		}

		long[] nextLongArray(int n) {
			long[] in = new long[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextLong();
			}
			return in;
		}
	}
}

//################################################################################################################
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.math.BigInteger;
import java.util.InputMismatchException;

//################################################################################################################
public class R283D2A {
	public static void main(String[] args) {
		R283D2A a = new R283D2A();
		InputReader1 reader = a.new InputReader1(System.in);
		OutputWriter writer = a.new OutputWriter(System.out);
		// think about the brute-force approach
		// read input
		// code boundary conditions
		int n = reader.readInt();
		int[] h = new int[n];
		int mxh = Integer.MAX_VALUE;
		for (int i = 0; i < h.length; i++) {
			h[i] = reader.readInt();
		}
		for (int i = 1; i < h.length - 1; i++) {
			int tmp = h[i + 1] - h[i - 1];
			for (int j = 1; j < i; j++) {
				if (h[j] - h[j - 1] > tmp) {
					tmp = h[j] - h[j - 1];
				}
			}
			for (int j = i + 2; j < h.length; j++) {
				if (h[j] - h[j - 1] > tmp) {
					tmp = h[j] - h[j - 1];
				}
			}
			mxh = Math.min(mxh, tmp);
		}
		writer.println(mxh);
		reader.close();
		writer.close();
	}

	class InputReader1 {
		// private final boolean finished = false;

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader1(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int length = readInt();
			if (length < 0)
				return null;
			byte[] bytes = new byte[length];
			for (int i = 0; i < length; i++)
				bytes[i] = (byte) read();
			try {
				return new String(bytes, "UTF-8");
			} catch (UnsupportedEncodingException e) {
				return new String(bytes);
			}
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private String readLine0() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public String readLine() {
			String s = readLine0();
			while (s.trim().length() == 0)
				s = readLine0();
			return s;
		}

		public String readLine(boolean ignoreEmptyLines) {
			if (ignoreEmptyLines)
				return readLine();
			else
				return readLine0();
		}

		public BigInteger readBigInteger() {
			try {
				return new BigInteger(readString());
			} catch (NumberFormatException e) {
				throw new InputMismatchException();
			}
		}

		public char readCharacter() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			return (char) c;
		}

		public double readDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, readInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public boolean isExhausted() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value == -1;
		}

		public String next() {
			return readString();
		}

		public boolean readBoolean() {
			return readInt() == 1;
		}

		public void close() {
			try {
				stream.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

	class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream stream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
					stream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void println(String s) {
			writer.println(s);
		}

		public void println(int x) {
			writer.println(x);
		}

		public void print(int x) {
			writer.print(x);
		}

		public void println(long x) {
			writer.println(x);
		}

		public void printSpace() {
			writer.print(" ");
		}

		public void close() {
			writer.close();
		}
	}
}

import java.io.*;
import java.util.StringTokenizer;

/**
 * @author baha
 */
public class TemplateCodeforcesProblemA {

    private static Scanner in;
    private static Output out;

    public static void main(String[] args) throws Exception {
        initReaderWriter();
        solve();
        out.close();
    }

    public static void solve() throws Exception {
        int n = in.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }

        int min = Integer.MAX_VALUE;
        for (int i = 1; i <= n - 2; i++) {
            int max = Integer.MIN_VALUE;
            for (int j = 0; j < n - 1; j++) {
                if(i==j){
                    continue;
                }
                if (j==i-1) {
                    max = Math.max(max, a[j + 2] - a[j]);
                }else{
                    max = Math.max(max, a[j + 1] - a[j]);
                }
            }
            min = Math.min(min, max);
        }

        out.println(min);

    }

    private static void initReaderWriter() throws Exception {
        boolean isFile = false;
        if (isFile) {
            in = new Scanner("input.txt");
            out = new Output(new File("output.txt"));
        } else {
            in = new Scanner();
            out = new Output(System.out);
        }
    }

    private static class Scanner {

        StringTokenizer st = null;
        BufferedReader bf;

        public Scanner() {
            bf = new BufferedReader(new InputStreamReader(System.in));
        }

        public Scanner(String fileName) throws FileNotFoundException {
            bf = new BufferedReader(new FileReader(fileName));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(bf.readLine());
            }
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return bf.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }

    private static class Output extends PrintStream {

        public Output(OutputStream out) {
            super(new BufferedOutputStream(out));
        }

        public Output(File file) throws FileNotFoundException {
            super(new BufferedOutputStream(new FileOutputStream(file)));
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.lang.management.MemoryType;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.function.Function;

public class Main {
    static final int INF = Integer.MAX_VALUE;

    static int mergeSort(int[] a,int [] c, int begin, int end)
    {
        int inversion=0;
        if(begin < end)
        {
            inversion=0;
            int mid = (begin + end) >>1;
            inversion+= mergeSort(a,c, begin, mid);
            inversion+=mergeSort(a, c,mid + 1, end);
            inversion+=merge(a,c, begin, mid, end);
        }
        return inversion;
    }

    static int  merge(int[] a,int[]c, int b, int mid, int e)
    {
        int n1 = mid - b + 1;
        int n2 = e - mid;
        int[] L = new int[n1+1], R = new int[n2+1];
        int[] L1 = new int[n1+1], R1 = new int[n2+1];

        //inversion
        int inversion=0;

        for(int i = 0; i < n1; i++) {
            L[i] = a[b + i];
            L1[i] = c[b + i];
            //  L2[i] = w[b + i];
        }
        for(int i = 0; i < n2; i++)  {
            R[i] = a[mid + 1 + i];
            R1[i] = c[mid + 1 + i];
            //R2[i] = w[mid + 1 + i];
        }
        L[n1] = R[n2] = INF;

        for(int k = b, i = 0, j = 0; k <= e; k++)
            if(L[i] <= R[j]){
                a[k] = L[i];
                c[k] = L1[i];
                ++i;
                //  w[k]=L2[i++];
            }

            else
            {
                a[k] = R[j];
                c[k] = R1[j];
                //w[k] = R2[j++];
                ++j;

                inversion=inversion+(n1-i);

            }
        return inversion;

    }

    static long gcd(long a, long b)
    {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static long a,b,c,k;
    static int bs(Long []a,long e,int i){
        int  r=i,l=0,mid=0,ans=-1;
        while (r>=l){
            mid=(r+l)>>1;
            if (a[mid]>e){
                ans=mid;
                r=mid-1;
            }
            else l=mid+1;
        }
        return ans;
    }

    public static void main (String[]args) throws IOException {
        Scanner in = new Scanner(System.in);
        try(PrintWriter or = new PrintWriter(System.out)) {

       int n = in.nextInt();
       int [] a= new int[n];
       int ans=Integer.MAX_VALUE;
            for (int i = 0; i < n; i++) {
                a[i]=in.nextInt();
            }

            for (int i = 1; i < n-1; i++) {
                ans=Math.min(ans,a[i+1]-a[i-1]);
            }
            or.println(ans);

        }

    }

    static int getlen(int r,int l,int a){
        return (r-l+1+1)/(a+1);
    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}

class Pair implements Comparable<Pair> {
    int first, second;

    public Pair(int first, int second) {
        this.first = first;
        this.second = second;
    }

    @Override
    public int compareTo(Pair o) {
        return first - o.first;
    }

}

class Tempo {

    int num;
    int index;

    public Tempo(int num, int index) {
        this.num = num;
        this.index = index;
    }
}

import java.util.Scanner;
public class A {
 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();
	    }
	    int max=0,min=1000000;
	  for(int k=1;k<=n-2;k++){
		   for(int i=0;i<=n-2;i++){
			   if(a[i]!=a[k] && a[i+1]!=a[k]){
				    if(a[i+1]-a[i]>max) max=a[i+1]-a[i];
			   }
			   else if(a[i]!=a[k] && a[i+1]==a[k]){
				       if(a[i+2]-a[i]>max) max=a[i+2]-a[i];
			   }

		   }
		   if(max<min) min=max;
	  }
	  System.out.println(min);

 }
	}

import java.util.Scanner;
public class MinimumDifficulty
{
	public static void main(String[] args)
	{
		Scanner jcsb=new Scanner(System.in);
		int j,n,i,min=9999,max=-9999,h=2;
		int[] a=new int[1000];
		n=jcsb.nextInt();
		for(i=1;i<=n;i++)
			a[i]=jcsb.nextInt();
		if(n==3)
			System.out.println(a[3]-a[1]);
		else
			for(i=1;i<=n;i++)
			{
				for(j=2;j<=n-1;j++)
				{
					if(j==h)
						max=Math.max(max,a[j+1]-a[j-1] );
					max=Math.max(max, a[j+1]-a[j]);
				}
				h++;
				min=Math.min(min, max);
			}
		System.out.println(min);
	}
}

import java.util.*;

public class watermelon {
	public static void main(String[] args){

		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int arr[] = new int[n];
		int temp = 0;
		int max = Integer.MIN_VALUE;
		for(int i=0; i<n;i++) {
			arr[i] =s.nextInt();
			if(arr[i]-temp>max) {
				max = arr[i] -temp;
			}
			temp = arr[i];
		}
		int max1 = Integer.MIN_VALUE;
		for(int i=1 ;i<n-1;i++) {
			if(arr[i+1]-arr[i-1]>max1) {
				max1 = arr[i+1]-arr[i-1];
			}
		}
		System.out.println(Math.min(max, max1));

	}
}

import java.util.*;

public class MinimumDifficulty {

	private static Scanner sc;

	public static void main(String[] args) {
		sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		a[0] = sc.nextInt();
		int[] diff = new int[n-1];
		for(int i=1; i<n; i++){
			a[i] = sc.nextInt();
			diff[i-1] = a[i]-a[i-1];
		}
		System.out.println(minDiff(a, diff));
	}

	private static int minDiff(int[] a, int[] diff) {
		int res=Integer.MAX_VALUE;
		int temp, curMax;
		int n = a.length;
		for(int i=0; i<n-2; i++) {
			curMax = 0;
			for(int j=0; j<n-2; j++) {
				if(j==i){
					temp = diff[i]+diff[i+1];
					j++;
				}
				else
					temp = diff[j];
				if(temp>curMax)
					curMax = temp;
			}
			if(curMax<res)
				res = curMax;
		}
		return res;
	}

}

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		int inputSize = input.nextInt();

		int[] arr = new int[inputSize];
		int[] diff1 = new int[inputSize];

		for(int i=0; i<arr.length; i++)
		{
			arr[i] = input.nextInt();
		}

		int maxDiff = Integer.MIN_VALUE;

		//calculating degree 1 difference assume no removal
		for(int i=0; i<arr.length-1; i++)
		{
			diff1[i] = arr[i+1] - arr[i];
			if(diff1[i] > maxDiff)
				maxDiff = diff1[i];
		}

		int maxTillNow = Integer.MAX_VALUE;

		//bruteforce
		for(int i=1; i<arr.length-1; i++)
		{
			//removing element arr[i]
			int difference = arr[i+1] - arr[i-1];

			for(int j=0; j<i; j++)
			{

				if(difference > diff1[i])
					maxTillNow = difference;
			}

			//removing element arr[i]
			for(int j=i+1; j<arr.length-1; j++)
			{

				if(difference > diff1[i])
					maxTillNow = difference;
			}

		}

		if(maxTillNow < maxDiff)
			System.out.println(maxTillNow);
		else
		  System.out.println(maxDiff);

	}

}

//package codeforces;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class MinimumDifficulty {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine().trim());
		String str[] = br.readLine().trim().split(" ");
		int nums[] = new int[n];
		int dif[] = new int[n-1];
		nums[0] = Integer.parseInt(str[0]);
		for(int i=1;i<n;i++) {
			nums[i] = Integer.parseInt(str[i]);
			dif[i-1] = nums[i] - nums[i-1];
		}
		Arrays.sort(dif);
		System.out.println(Math.max(dif[0]+dif[1], dif[n-2]));
	}

}

import java.io.*;
import java.util.*;
public class difficulty
{
 public static void main(String args[])
 {
  Scanner sc=new Scanner(System.in);
  int i,c,n,l;
  c=l=0;
  String[] x=sc.nextLine().split(" ");
  n=Integer.parseInt(x[0]);
  int[] a=new int[n];
  x=sc.nextLine().split(" ");
  for(i=0;i<n;i++)
  a[i]=Integer.parseInt(x[i]);
  for(i=0;i<(n-1);i++)
  {
   a[i]=a[i+1]-a[i];
   if(a[i]>l)
   l=a[i];
  }
  for(i=0;i<(n-1);i++)
  {
   if(a[i]==l)
   c++;
  }
  if(c==(n-1))
  System.out.println(2*l);
  else if(n>=5 || (n==4 && a[1]!=l))
  System.out.println(l);
  else if(n==3)
  System.out.println(a[0]+a[1]);
  else if(n==4)
  System.out.println(l+(int)Math.min(a[0],a[2]));
 }
}

import java.util.Scanner;
public class MinimumDifficulty {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int max = 0;
    int min = 1000;
    int n = scanner.nextInt();
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = scanner.nextInt();
    }
    for (int j = 1; j < n - 1; j++) {
      for (int i = 0; i < n; i++) {
          if (i == j + 1) {
            if (array[i] - array[i - 2] > max) {
              max = array[i] - array[i - 2];
            }
          } else if ( i != j && i != 0 && array[i] - array[i - 1] > max) {
            max = array[i] - array[i - 1];
          }
        }
      if (min > max) {
        min = max;
      }
    }
    System.out.println(min);
  }
}

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.ArrayList;
import java.util.Collections;
import java.lang.Math;

public class Lo {
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      ArrayList<Integer> A = new ArrayList<Integer>();
      ArrayList<Integer> B = new ArrayList<Integer>();
      int n = sc.nextInt();
      for(int i = 0; i < n; i++){
          A.add(sc.nextInt());
      }
      for(int i = 1; i < n-1; i++){
          A.remove(i);
          int max = 0;
          for(int j = 0; j < n-3; j++){
              int diff = A.get(j+1)-A.get(j);
              if(diff>max){
                  max = diff;
              }
          }
          B.add(max);
      }
      Collections.sort(B);
      System.out.println(B.get(0));
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        String str[]=br.readLine().split(" ");
        int a[]=new int[n];
        for(int i=0;i<n;i++)
            a[i]=Integer.parseInt(str[i]);
        int min=10000000,diff=0,max=-1000000;
        for(int i=1;i<n-1;i++)
        {
            for(int j=1;j<n;j++)
            {
                if(j!=i)
                {
                    if(j-1==i)
                        diff=a[j]-a[j-2];
                    else
                        diff=a[j]-a[j-1];
            //      System.out.println(diff+" "+max);
                    max=Math.max(max,diff);
                }
            }
            min=Math.min(min,max);
        }
        System.out.println(min);
    }
}

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;

public class D2_283A {
	public static void main(String[] args) {
		try (Scanner scan = new Scanner(System.in)) {
			int N = Integer.parseInt(scan.nextLine());
			StringTokenizer st = new StringTokenizer(scan.nextLine());
			int pr = n(st);
			List<Integer> diff = new ArrayList<>();
			for (int i = 1; i < N; i++) {
				int t = n(st);
				diff.add(t - pr);
				pr = t;
			}
			int min = diff.get(0) + diff.get(1);
			for (int i = 1; i < N - 2; i++) {
				min = Math.min(min, diff.get(i) + diff.get(i + 1));
			}
			System.out.println(diff);
			System.out.println(min);
		}
	}

	static int n(StringTokenizer st) {
		return Integer.parseInt(st.nextToken());
	}
}

import java.util.*;
import java.io.*;
public class Solution {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out,true);
        //StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine());
        int[] a = new int[n];
        for(int i =0;i<n;i++){
            a[i] = Integer.parseInt(st.nextToken());
        }
     int df=0;
     for(int i =0;i<n-1;i++){
         df = Math.min(df, Math.abs(a[i+1]-a[i]));
     }
     for(int i =0;i<n-2;i++){
         df = Math.max(df, Math.abs(a[i+2]-a[i]));
     }
     out.println(df);
    }
}

import java.util.Scanner;

public class MinimumDifficulty {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        int n = s.nextInt();

        int[] a = new int[n];

        for (int i=0; i<n; i++){
            a[i] = s.nextInt();
        }
        int[] help = new int[n];
        for (int i=2; i<n; i++){
            help[i] = a[i]-a[i-2];
        }
        int max=help[2];
        for (int i=2; i<n; i++){
            if (help[i]>max)
                max = help[i];
        }

        System.out.println(max);
    }
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.security.KeyStore.Entry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;

public class MainTwo {
    static FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(System.out);
    static boolean file = false;
    static final int maxn = (int)4e6 + 111;
    static int inf = (int)1e9;
    static int n,k,m,cnt;
    static int a[] = new int [maxn];

    private static void solve() throws Exception {
        n = in.nextInt();
        for (int i=1; i<=n; i++) {
            a[i] = in.nextInt();
        }

        int min = Integer.MAX_VALUE;
        for (int i=2; i<n; i++) {
            int max = Integer.MIN_VALUE;
            for (int j=1; j<=n; j++) {
                if (j==i) {
                    max = Math.max(max, a[j+1] - a[j-1]);
                }
                max = Math.max(max, a[j] - a[j-1]);
            }
            min = Math.min(max, min);
        }

        out.println(min);
    }

    public static void main (String [] args) throws Exception {

        if (file) {
            in = new FastReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter ("output.txt");
        }

        solve();
        out.close();
    }

}

class Pair implements Comparable<Pair> {
    int x,y;

    public Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }
    @Override
    public boolean equals(Object obj) {
        Pair p = (Pair)obj;
        if (p.x == x && p.y==y) return true;
        return false;
    }
    @Override
    public int hashCode() {
        // TODO Auto-generated method stub
        return x;
    }
    @Override
    public int compareTo(Pair p) {
        if (x<p.x)return 1;
        else if (x==p.x) return 0;
        else return -1;
    }

}

class FastReader {
    BufferedReader bf;
    StringTokenizer tk = null;

    public FastReader(BufferedReader bf) {
        this.bf = bf;
    }

    public String nextToken () throws Exception {
        if (tk==null || !tk.hasMoreTokens()) {
            tk = new StringTokenizer(bf.readLine());
        }
        return tk.nextToken();
    }

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

import java.io.*;
import java.util.*;
public class task{
    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();
        int high=a[0];
        int max[]=new int[n-2];
        int t=0;
        for(int i=1;i<n-1;i++){
            int d=a[i];
            int b[]=new int[n-1];
            b[0]=a[0];
            b[n-2]=a[n-1];
            int c=1;
            for(int j=1;j<n-2;j++,c++){
                if(a[c]==d){
                    j--;
                    continue;
                }
                else{
                    b[j]=a[c];
                    //c++;
                }
            }

            for(int j=0;j<n-2;j++){
                int diff= b[j+1]-b[j];
                if(diff>high)
                    high=diff;
            }
            max[t++]=high;
        }
        int low=max[0];
        for(int i=0;i<n-2;i++){
            if(max[i]<low)
                low = max[i];
        }
        System.out.print(low);
    }
}

import java.util.Scanner;

/**
 *
 * @author Mostafa POP
 */
public class Codeforces {
    /**
     * @param args the command line arguments
     */
    public static int MinimumDifficulty(int arr[]){
        int min=800;
        for(int i=1;i<arr.length-1;i++){
            int max=0;
            for(int j=1;j<arr.length-1;j++){
                if(i==j){
                    if(arr[j+1]-arr[j-1]>max){
                        max=arr[j+1]-arr[j-1];
                    }

                }
                else{
                  if(arr[j+1]-arr[j]>max){
                        max=arr[j+1]-arr[j];
                    }
                }
            }
            if(max<min){
                min=max;
            }
        }
        return min;
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int holds=sc.nextInt();
        int arr[]=new int [holds];
        for(int i=0;i<arr.length;i++){
            int t=sc.nextInt();
            arr[i]=t;
        }
        int m=MinimumDifficulty(arr);
        System.out.println(m);
    }
}

import java.io.*;
import java.util.*;

public class A{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine()," ");
        int[] a = new int[n];
        for (int i=0; i < n; i++){
            a[i] = Integer.parseInt(st.nextToken());
        }
        int[] d = new int[n-1];
        for (int i=0; i < n-1; i++){
            d[i] = a[i+1] - a[i];
        }
        int mind = Integer.MAX_VALUE;

        for (int i=0; i < n-2;i++){
            int[] d1 = new int[n-2];
            System.arraycopy(d, 0, d1, 0, n-2);
            d1[i] = d[i] + d[i+1];

         int maxd = 0;
            for (int j=0; j < n-2; j++){
               // System.out.println("d1[" + j + "]=" + d1[j]);
                if (d1[j] > maxd){
                    maxd = d1[j];
                }
            }
            if (maxd < mind){
                mind = maxd;
            }
        }
        System.out.println(mind);

    }
}

import java.util.*;
import java.io.*;

public class Main implements Runnable {

	public void solve() throws IOException {
		int N = nextInt();
                int[] a = new int[N];
                for(int i = 0; i < N; i++) a[i] = nextInt();
                int answer = Integer.MAX_VALUE;

                for(int i = 1; i < N-1; i++) {
                    int cur = a[i+1] - a[i-1];
                    answer = Math.min(answer, cur);
                }

                out.println(answer);
	}

	//-----------------------------------------------------------
	public static void main(String[] args) {
		new Main().run();
	}

        public void debug(Object... arr){
            System.out.println(Arrays.deepToString(arr));
        }

        public void print1Int(int[] a){
                for(int i = 0; i < a.length; i++)
                        System.out.print(a[i] + " ");
                System.out.println();
        }

        public void print2Int(int[][] a){
                for(int i = 0; i < a.length; i++){
                        for(int j = 0; j < a[0].length; j++){
                                System.out.print(a[i][j] + " ");
                        }
                        System.out.println();
                }
        }

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
                        out = new PrintWriter(System.out);
			tok = null;
			solve();
			in.close();
                        out.close();
		} catch (IOException e) {
			System.exit(0);
		}
	}

	public String nextToken() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
        PrintWriter out;
	BufferedReader in;
	StringTokenizer tok;
}

/**
 * Minimum Difficulty Problem: http://codeforces.com/problemset/problem/496/A
 *
 * @author gaber
 *
 */

import java.util.Arrays;
import java.util.Scanner;

public class A496 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] holds = new int[n];
		for (int i = 0; i < n; i++) {
			holds[i] = in.nextInt();
		}
		int[] difficulties = new int[n - 2];
		for (int i = 1; i < n - 1; i++) {
			int maxDiff = Integer.MIN_VALUE;
			for (int j = 0; j < n - 2; j++) {
				if (j + 1 != i)
					maxDiff = Math.max(maxDiff, holds[j + 1] - holds[j]);
				else
					maxDiff = Math.max(maxDiff, holds[j + 2] - holds[j]);
			}
			difficulties[i - 1] = maxDiff;
		}
		Arrays.sort(difficulties);
		System.out.println(difficulties[0]);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class MinimumDifficulty {

	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		StringTokenizer st = new StringTokenizer(br.readLine());

		int[] a = new int[n];

		for(int i = 0; i < n; i++)
		{
			a[i] = Integer.parseInt(st.nextToken());
		}

	    /*int min = 1001;
	    for(int i = 1; i < n - 1; i++)
	    {
	    	int max = -1;

	    	for(int j = 0; j < n - 2; j++)
	    	{
	    		if(j == i - 1)
	    		{
	    			max = Math.max(a[j + 2] - a[j], max);
	    			j++;
	    		}
	    		else
	    			max = Math.max(max,a[j + 1] - a[j]);
	    	}

	    	min = Math.min(max,  min);
	    }

	    System.out.println(min);*/

		if(n == 3)
		{
			System.out.println(a[2] - a[0]);
			return;
		}

		int max  = -1;
		int diff = a[1] - a[0];

		boolean flag = false;
		for(int i = 1; i < n;i++)
		{
			max = Math.max(a[i] - a[i - 1], max);

			if(max != diff)
				flag = true;
		}

		if(flag)
			System.out.println(max);
		else
			System.out.println(diff * 2);

	}

}

import java.util.*;
import java.io.*;

public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int a = Integer.MIN_VALUE;

        if(n==3){
        	int b = sc.nextInt();
        	sc.nextInt();
        	int c = sc.nextInt();
        	a=c-b;
        }

        else{
        	int b = sc.nextInt();
        	for(int i=0; i<n-1; i++){
        		int c = sc.nextInt();
        		if(c-b!=a){
        		a = Math.max(a, c-b);
        	}
        	else{
        		a*=2;
        	}

        		b = c;

        	}
        }

        System.out.println(a);

    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

public class B {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        BInputReader in = new BInputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    public void solve(int testNumber, BInputReader in, PrintWriter out) {
        //Read inputs and write the main function.
        int n = in.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++) a[i] = in.nextInt();
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        for(int i=1,k=1;i<=n-2;i++,k++) {
            max = Math.max(max,Math.abs(a[k-1]-a[k+1]));
            for(int j=1;j<n;j++)
                if(j!=k) max = Math.max(max,Math.abs(a[j]-a[j-1]));
            min = Math.min(min,max);
        }
        out.println(min);
    }
}

class BInputReader {
    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public BInputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public Long nextLong() {
        return Long.parseLong(next());
    }
}

import java.util.Scanner;

public class Climb {
    public static void main(String[] args) {
        Scanner n = new Scanner(System.in);
        int holds=n.nextInt();
        int line [] = new int [10000];
        for (int i = 0; i <holds; i++) {
            int l = n.nextInt();
            line[i]=l;
        }
        int min=0;
        int min1=100000000;
        for (int i = 1; i <holds-1; i++) {
            for(int j=0;j<holds-1;j++){
                if(j==i-1){
                    if(line[j+2]-line[j]>min)
                        min=line[j+2]-line[j];
                }
                else{
                    if(line[j+1]-line[j]>min)
                        min=line[j+1]-line[j];
                }
            }
            if (min<min1)
                min1=min;
        }
        System.out.println(min1);
    }

}

import java.util.*;

public class A496 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), smallest = 2, largest = 2;
		List<Integer> w = new ArrayList<Integer>();
		for(int i = 0; i < n ; i++)
			w.add(in.nextInt());

		for(int i = 1; i < n-1; i++)
		{
			int q = w.remove(i);
			if(i == 1)
			{
				largest = w.get(i) - w.get(i-1);
				for(int j = 1; j < w.size(); j++){
					if((w.get(j)-w.get(j-1)) > largest)
						largest = w.get(j) - w.get(j-1);
				}
			}
			else
			{
				for(int j = 1; j < w.size(); j++)
				{
					if(((w.get(j) - w.get(j-1)) < largest && ((w.get(j) - w.get(j-1)) > 2)))
						largest = w.get(j) - w.get(j-1);
				}
			}
			System.out.println(largest);
			w.add(i, q);
		}

//
//		if(n > 3)
//		{
//			for(int i = 1; i < (n-1); i++)
//			{
//				int t = w.remove(i);
//				for(int r = 0; r < w.size()-1; r++)
//				{
//					if(i == 1)
//					{
//						int z = w.get(r+1) - w.get(r);
//						if(z > smallest)
//							first = w.get(r+1) - w.get(r);
//					}
//					else
//					{
//						if((w.get(r+1) - w.get(r)) > first)
//							smallest = w.get(r+1) - w.get(r);
//					}
//				}
//				w.add(i, t);
//			}
//		}
//		else
//			first = w.get(2) - w.get(0);
//		System.out.println(first);
	}
}

import java.util.Scanner;

public class Problem_496A
{
	public static void main(String[] args)
	{
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		//int[] data = new int[n];
		int[] gap = new int[n - 1];

		int now = -1;
		int previous = -1;
		int max = 0;
		for(int i = 0; i < n; i++)
		{
			if(i != 0)
			{
				previous = now;
			}
			now = input.nextInt();
			if(i != 0)
			{
				gap[i - 1] = now - previous;
				if(gap[i - 1] > max)
				{
					max = gap[i - 1];
				}
			}
		}

		int min = max;
		for(int i = 0; i < gap.length - 1; i++)
		{
			if(gap[i] + gap[i + 1] < min && gap[i] + gap[i + 1] >= max)
			{
				min = gap[i] + gap[i + 1];
			}
		}
		System.out.println(min);
	}
}

import java.util.Arrays;
import java.util.Scanner;
public class A_MinimumDifficulty {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int num = in.nextInt();
        int arr [] = new int [num];
        for(int i = 0 ; i < num ; i++)
        {
            arr[i] = in.nextInt();
        }
        int count = 0 ;
        int res = arr[num-1] - arr[0];
        int tempArr [] = new int [num-1];
        int rakm = 0 ;
        for(int j = 0 ; j < num-2 ;j++ ) {
            rakm++;
            for(int k = 0 ;k < num-1 ;k++){
                if(rakm == k)
                    tempArr[k] = arr[k+1];
                else
                    tempArr[k] = arr[k];
            }
            int temp = 0;
            for (int i = 0; i+1 < num - 1; i++) {
                if ((tempArr[i + 1] - tempArr[i]) > temp)
                    temp = tempArr[i + 1] - tempArr[i];
            }
            if (res > temp)
                res = temp;
        }
        System.out.println(res);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Harshal Khodifad
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ProblemAMinimumDifficulty solver = new ProblemAMinimumDifficulty();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemAMinimumDifficulty {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();

            ArrayList<Integer> a = new ArrayList<>(n);

            for (int i = 0; i < n; i++) a.add(in.nextInt());

            int min_dis = 1000;
            int dis = 0;

            for (int i = 1; i < n - 1; i++) {
                ArrayList<Integer> b = new ArrayList(a);
                b.remove(i);
                //out.println(b);

                for (int j = 0; j < n - 2; j++) {
                    if (dis < (b.get(j + 1) - b.get(j))) dis = b.get(j + 1) - b.get(j);
                }
                if (dis < min_dis) min_dis = dis;
            }

            out.println(min_dis);
        }

    }
}

import java.util.Scanner;

public class CF496A {

	public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int[] a=new int[n];int[] b=new int[n-1];int[] c=new int[n-2];int maxb=0;int minc=100000;int index=-1;
		a[0]=scan.nextInt();
		for(int i=1;i<n;i++) {
			a[i]=scan.nextInt();
			b[i-1]=a[i]-a[i-1];if(b[i-1]>maxb)maxb=b[i-1];}
		if(n==3)System.out.println(a[2]-a[0]);
		else {
		for(int i=0;i<n-2;i++) {c[i]=b[i]+b[i+1];if(c[i]<minc&&i!=0&&i!=n-2) {minc=c[i];index=i;}  }
		if(b[index+1]-b[index]>maxb)maxb=b[index+1]-b[index];

	/*	for(int i=0;i<n;i++) {System.out.print(a[i]+" ");}System.out.println();
		for(int i=0;i<n-1;i++) {System.out.print(b[i]+" ");}System.out.println();
		for(int i=0;i<n-2;i++) {System.out.print(c[i]+" ");}

		System.out.println();*/

		 System.out.println(maxb);}
	}

}

import java.io.*;
import java.util.*;

public class A{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine()," ");
        int[] a = new int[n];
        for (int i=0; i < n; i++){
            a[i] = Integer.parseInt(st.nextToken());
        }
        int[] d = new int[n-1];
        for (int i=0; i < n-1; i++){
            d[i] = a[i+1] - a[i];
        }
        int mind = Integer.MAX_VALUE;
        for (int i=0; i < n-2;i++){
            d[i] = d[i] + d[i+1];
         int maxd = 0;
            for (int j=0; j < n-2; j++){
                if (d[j] > maxd){
                    maxd = d[j];
                }
            }
            if (maxd < mind){
                mind = maxd;
            }
        }
        System.out.println(mind);

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author adzo261
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA
    {
        public void solve(int testNumber, InputReader in, OutputWriter out)
        {
            int n = in.nextInt();
            int a[] = in.nextIntArray(n);
            int max = 0;
            int ans = Integer.MAX_VALUE;
            for (int i = 0; i < n - 1; i++)
            {
                max = Math.max(max, a[i + 1] - a[i]);
            }
            for (int i = 1; i < n - 1; i += 2)
            {
                if (a[i + 1] - a[i - 1] > max)
                    ans = Math.min(ans, a[i + 1] - a[i - 1]);
                else
                    ans = Math.min(ans, max);
            }
            out.printLine(ans);
        }

    }

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars == -1) throw new InputMismatchException();
            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) return -1;
            }
            return buf[curChar++];
        }

        public int nextInt()
        {
            int c = read();
            while (isSpaceChar(c)) c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] nextIntArray(int size)
        {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
                array[i] = nextInt();
            return array;
        }

        public interface SpaceCharFilter
        {
            boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter
    {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream)
        {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer)
        {
            this.writer = new PrintWriter(writer);
        }

        public void printLine(int i)
        {
            writer.println(i);
        }

        public void close()
        {
            writer.close();
        }

    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
     Scanner sc =new Scanner(System.in);
     int i,n,min,j,diff;
     n=sc.nextInt();
     int a[]=new int[105];
     for(i=0;i<n;i++)
     a[i]=sc.nextInt();
     diff=-1;
     min=100000000;
     for(j=1;j<n-1;j++)
      {
       for(i=0;i<j-1;i++)
         if(diff<a[i+1]-a[i])
           diff=a[i+1]-a[i];

       for(i=j+1;i<n-1;i++)
        if(diff<a[i+1]-a[i])
         diff=a[i+1]-a[i];

        if(diff<a[j+1]-a[j-1])
         diff=a[j+1]-a[j-1];

       if(diff<min)
       min=diff;
      }
     System.out.println(min);
    }
}

import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class solver implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
    }

    String readString() {
        try {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return tok.nextToken();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

    long readLong() {
        return Long.parseLong(readString());
    }

    double readDouble() {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Thread(null, new solver(), "", 256 * (1L << 20)).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            init();
            solve();
            out.close();
            // time();
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    void solve() {
        int n = readInt();
        int[] a = new int[n];
        for (int i=0;i<n;i++) {
            a[i] = readInt();
        }
        int left = a[0];
        int max = -1;
        for (int i=2;i < n; i++) {
            max = Math.max(max, a[i] - left);
            left = a[i - 1];
        }
        out.println(max);
    }
}

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.lang.*;
import java.util.*;
import java.math.*;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.lang.String;

public class Solution {

    public static void main(String[] args) {
        new Solution().myRun();
    }

    FastInputScanner in;
    PrintWriter out;

    void solveTask() {
        int n = in.nextInt();
        int [] a = new int [n];
        a = in.nextIntArray(n);
        int answer = 0;
        for (int i = 0; i < n; ++i) {
            ArrayList<Integer> myList = new ArrayList<Integer>();
            for (int j = 0; j < n; ++j) {
                if (i != j) {
                    myList.add(a[j]);
                }
            }
            int currentAnswer = 0;
            for (int j = 1; j < myList.size(); ++j) {
                if (myList.get(j) - myList.get(j - 1) > currentAnswer) {
                    currentAnswer = myList.get(j) - myList.get(j - 1);
                }
            }
            if (currentAnswer > answer) {
                answer = currentAnswer;
            }
        }
        out.println(answer);
    }

    void myRun() {
        in = new FastInputScanner(System.in);
        out = new PrintWriter(new OutputStreamWriter(System.out));
        solveTask();
        out.close();
    }

    void myRunIO(){
        try  {
            in = new FastInputScanner(new File("input.txt"));
            out = new PrintWriter(new FileWriter(new File("output.txt")));
            solveTask();
            out.close();
        } catch(Exception exception){
            exception.printStackTrace();
        }
    }

    class FastInputScanner{

        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        public FastInputScanner(File file){
            try{
                bufferedReader = new BufferedReader(new FileReader(file));
            }
            catch(IOException exception){
                exception.printStackTrace();
            }
        }

        public FastInputScanner(InputStream inputStream){
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream), 32768);
        }

        String next(){
            while(stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch(IOException exception) {
                    exception.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        int nextInt(){
            return Integer.parseInt(next());
        }

        double nextDouble(){
            return Double.parseDouble(next());
        }

        float nextFloat(){
            return Float.parseFloat(next());
        }

        String nextLine(){
            try {
                return bufferedReader.readLine();
            }
            catch(Exception exception) {
                exception.printStackTrace();
            }
            return "";
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }

        int[] nextIntArray(int n) {
            int a[] = new int[n];
            for(int i = 0; i < n; i++)
                a[i] = Integer.parseInt(next());
            return a;
        }

        long[] nextLongArray(int n){
            long a[] = new long [n];
            for(int i = 0; i < n; i++)
                a[i] = Long.parseLong(next());
            return a;
        }

        double[] nextDoubleArray(int n){
            double a[] = new double [n];
            for(int i = 0; i < n; i++)
                a[i] = Double.parseDouble(next());
            return a;
        }
    }

}

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,min=200;
		for(int j=0;j<n;j++){
		    a[j]=sc.nextInt();
		    if(j>0){
		        if(a[j]-a[j-1]>max){
		            max=a[j]-a[j-1];
		        }
		    }
		    if(j>1){
		        if(a[j]-a[j-2]<min){
		            min=a[j]-a[j-2];
		        }
		    }
		}
		if(min>max){
		    System.out.println(min);
		}
		else{
		    System.out.println(max);
		}
	}
}

import java.util.*;

public class Main {
    public static void main(String[] args) {
        // write your code here
        Scanner sc= new Scanner(System.in);
        int n=sc.nextInt();
        int[] nums=new int[n];
        for (int i = 0; i <n ; i++) {
         nums[i]=sc.nextInt();
        }
        int min=Integer.MAX_VALUE;
        int max=0;
        for (int i = 1; i <n-1 ; i++) {
            for (int j = 1; j<n; j++) {
                if((j-1)==i&&(j-2)>=0){
                    max=nums[j]-nums[j-2]>max?nums[j]-nums[j-2]:max;
                }else{
                    max=nums[j]-nums[j-1]>max?nums[j]-nums[j-1]:max;
                }
            }
            min=max<min?max:min;
        }
        System.out.println(min);
    }
}

import java.io.*;
import java.util.*;

public class A{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine()," ");
        int[] a = new int[n];
        for (int i=0; i < n; i++){
            a[i] = Integer.parseInt(st.nextToken());
        }
        int[] d = new int[n-1];
        for (int i=0; i < n-1; i++){
            d[i] = a[i+1] - a[i];
        }
        int mind = Integer.MAX_VALUE;

        for (int i=0; i < n-2;i++){
            int[] d1 = new int[n-2];
            System.arraycopy(d, 0, d1, 0, n-2);
            d1[i] = d[i] + d[i+1];

         int maxd = 0;
            for (int j=0; j < n-2; j++){
               // System.out.println("d1[" + j + "]=" + d1[j]);
                if (d1[j] >= maxd){
                    maxd = d1[j];
                }
            }
            if (maxd <= mind){
                mind = maxd;
            }
        }
        System.out.println(mind);

    }
}

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;
		for(int j=0;j<n;j++){
		    a[j]=sc.nextInt();
		    if(j>0){
		        if(a[j]-a[j-1]>max){
		            max=a[j]-a[j-1];
		        }
		    }
		}
		System.out.println(max);
	}
}

import java.util.Scanner;

public class find_d {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] ar = new int[n];
        for (int i = 0; i < n; i++) {
            ar[i] = in.nextInt();
        }
        int d = 0;
        int arr[] = new int[n-2];
        for(int i=1;i<n-1;i++) {
            for(int j=0;j<n-1;j++) {
                if ((j + 1 != i) && (j != i)) {
                    if (d < ar[j + 1] - ar[j]) d = ar[j + 1] - ar[j];
                } else {
                    if (j + 1 == i) {
                        if (ar[j + 2] - ar[j] > d) d = ar[j + 2] - ar[j];
                    }
                }
                arr[i-1] =d;
            }
        }
        int g = arr[0];
        for(int i =0;i<n-2;i++) {
            if (arr[i]< g) g = ar[i];
        }
        System.out.println(g);
    }
}

import java.util.*;
public class Main
{
	public static void main(String[] args) {
	    Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] arr=new int[n];
		for(int i=0;i<n;i++)
		{
		    arr[i]=sc.nextInt();
		}int md1=0;
		for(int i=1;i<n-1;i++)
		{int md=0;
		    for(int j=0;j<n-1;j++)
		    {
		        if(j!=i)
		        {
		            if(j+1==i)
		            {
		                int h=j+2;
		                if(Math.abs(arr[j]-arr[h])>md)
		                {
		                    md=Math.abs(arr[j]-arr[h]);
		                }

		            }
		                else{
		                    if(Math.abs(arr[j]-arr[j+1])>md)
		                {
		                    md=Math.abs(arr[j]-arr[j+1]);
		                }
		                }

		        }
		    }if(md>md1)md1=md;
		}
		System.out.println(md1);
	}
}

import java.util.*;
public class a498 {

    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int n=cin.nextInt();
        int []a=new int[n];
        int max=0,pos=1,ma=0;
        for (int i = 0; i < a.length; i++) {
            a[i]=cin.nextInt();
        }
        max=a[1]-a[0];
        for (int i = 1; i < a.length; i++) {
            if((a[i]-a[i-1])>max)
                {max=(a[i]-a[i-1]);pos=i;}
        }
        for(int i=pos;i<n-1;i++)
        {
            a[i]=a[i+1];
        }
        ma=a[1]-a[0];
        for (int i = 1; i < n-1; i++) {
            if((a[i]-a[i-1])>ma)
                {ma=(a[i]-a[i-1]);}
        }

        if(ma<max)
        System.out.println(ma);
        else System.out.println(max);
        cin.close();
    }

}

//package active;

import java.util.Scanner;

public class MinimumDifficulty {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int n = sc.nextInt();
        int[] heights = new int[n];
        int maxDifficulty = -1;

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

        int current;
        int next;
        int diff;
        int elementToRemove;
        int newDifficulty = 1000;
        for (int i = 1; i < n - 1; i++) {
            elementToRemove = heights[i];
            for (int j = 0; j < n - 1; j++) {
                if (heights[j] == elementToRemove) {
                    current = heights[j - 1];
                } else {
                    current = heights[j];
                }
                if (heights[j + 1] == elementToRemove) {
                    next = heights[j + 2];
                } else  {
                    next = heights[j + 1];
                }
                diff = next - current;
                if (diff > maxDifficulty) {
                    maxDifficulty = diff;
                }
                if (j == n - 2) {
                    if (maxDifficulty < newDifficulty) {
                        newDifficulty = maxDifficulty;
                    }
                }
            }
        }

        System.out.println(newDifficulty);
    }
}

import java.util.*;

public class A496 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), smallest = 2, largest = 2;
		List<Integer> w = new ArrayList<Integer>();
		for(int i = 0; i < n ; i++)
			w.add(in.nextInt());

		for(int i = 1; i < n-1; i++)
		{
			int q = w.remove(i);
			if(i == 1)
			{
				largest = w.get(i) - w.get(i-1);
				for(int j = 1; j < w.size(); j++){
					if((w.get(j)-w.get(j-1)) > largest)
						largest = w.get(j) - w.get(j-1);
				}
			}
			else
			{
				for(int j = 1; j < w.size(); j++)
				{
					if(((w.get(j) - w.get(j-1)) < largest && ((w.get(j) - w.get(j-1)) > 2)))
						largest = w.get(j) - w.get(j-1);
				}
			}
			w.add(i, q);
		}
		System.out.println(largest);
	}
}

import java.util.*;

public class _496A_Minimum_Difficulty {
    public static void main(String[] args) {
	Scanner in = new Scanner(System.in);

	int n = in.nextInt();
	int[] a = new int[n];
	for (int i = 0; i < n; i++)
	    a[i] = in.nextInt();
	int[] diff = new int[n - 1];
	for (int i = 1; i < n; i++)
	    diff[i - 1] = Math.abs(a[i] - a[i - 1]);

	int max = diff[0];
	int maxIndex = 0;
	for (int i = 0; i < diff.length; i++)
	    if (max < diff[i]) {
		max = diff[i];
		maxIndex = i;
	    }

	int[] rem = new int[n - 2];
	for (int i = 1; i < n - 1; i++)
	    rem[i - 1] = Math.abs(diff[i] + diff[i - 1]);
	int min = rem[0];
	int minIndex = 0;
	for (int i = 0; i < rem.length; i++)
	    if (min > rem[i]) {
		min = rem[i];
		minIndex = i;
	    }

	if (max > min)
	    System.out.println(max);
	else if (Math.abs(minIndex + 0.5 - maxIndex) < .6)
	    System.out.println(min);

    }
}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;

public class Main
{
    public static void main(String[] args)
    {
        // Fast in-out
        MyScanner in = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        // ***********************
            List<Integer> list = new ArrayList<>();
            Set<Integer> diffSet = new HashSet<>();
            int length = in.nextInt();

            for (int i =0; i< length; i++) {
                list.add(in.nextInt());
            }

            int max = 0;
            for (int i = 1; i < list.size(); i++) {
                int diff  = list.get(i) - list.get(i-1);
                diffSet.add(diff);

                if (diff > max) max = diff;
            }

            if (list.size() == 3) {
                out.println(list.get(length - 1) - list.get(0));
            }
            else {
                if (diffSet.size() == 1) out.print(max * 2);
                else out.print(max);
            }
        // ***********************

        out.close();
    }
}

class MyScanner
{
    BufferedReader br;
    StringTokenizer st;

    public MyScanner()
    {
        br = new BufferedReader(new InputStreamReader(System.in), 32768);
        st = null;
    }

    public String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
      try {
         str = br.readLine();
      } catch (IOException e) {
         e.printStackTrace();
      }
      return str;
    }
}

import java.io.*;
import java.util.StringTokenizer;

public class Test {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        String str = br.readLine();
        StringTokenizer st = new StringTokenizer(str, " ");
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(st.nextToken());
        }
        int min = Integer.MAX_VALUE, minIndex = -1;
        for (int i = 1; i < n - 1; i++) {
            if (arr[i] - arr[i - 1] < min) {
                min = arr[i] - arr[i - 1];
                minIndex = i;
            }
        }
        arr[minIndex] = -1;
        int max = Integer.MIN_VALUE;
        for (int i = 1; i < n; i++) {
            int c = 0;
            if (arr[i - 1] == -1) {
                c = 1;
            }
            if (arr[i] != -1) {
                if (max < arr[i] - arr[i - 1 - c]) {
                    max = arr[i] - arr[i - 1 - c];
                }
            }
        }
        bw.write(max + "\n");
        bw.flush();
    }
}

import java.util.*;
import java.lang.Math;

public class sdsd{
    public static void main(String sdssd[]){
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int a[]=new int[n];
        int z=1000,q=0;
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n-1;i++){
            for(int j=1;j<n;j++){
                if(j==i){
                    int w=a[j+1]-a[j-1];
                    q=Math.max(w,q);
                    j+=2;
                }
                else{
                    int w=a[j]-a[j-1];
                    q=Math.max(w,q);
                }
            }
            z=Math.min(z,q);
        }
        System.out.println(z);
    }
}

import java.util.Scanner;

public class MaxDiff {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in) ;
		int n = input.nextInt() ;
		int a[] = new int [n] ;
		for(int i = 0 ; i < n ; i++){
			a[i] = input.nextInt() ;
		}
		input.close();
		if(n == 3){
			System.out.print(a[2] - a[0]);
		}else {
			int min = a[2] - a[1];
			int index = 1 ;
			for(int i = 2 ; i < n - 1 ; i++){
				int temp = a[i + 1] - a[i] ;
				if(temp < min){
					min = temp ;
					index = i ;
				}
			}
			int max = 0 ;
			for(int i = 1 ; i < n ; i++){
				if( i == index - 1){
					int temp = a[i + 2] - a[i] ;
					if(temp > max){
						max = temp ;
					}
				}else if (i == index + 1){
					int temp = a[i] - a[i - 2] ;
					if(max < temp){
						max = temp ;
					}
				}else if( i != index){
					int temp = a[i] - a[i - 1] ;
					if(temp > max){
						max = temp ;
					}
				}
			}
			System.out.print(max);
		}
	}

}

import java.io.*;
import java.util.*;

public class Numbers
{
      public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());

            int minDifficulty = -1, difficulty = -1;
            int n = Integer.parseInt(st.nextToken());
            int[] rock = new int[n];
            st = new StringTokenizer(br.readLine());
            for(int i=0; i<n; i++)
                  rock[i] = Integer.parseInt(st.nextToken());

            for(int i=1; i<n-1; i++)
            {
                for(int j=0; j<n-1;)
                {
                    if(j+1 == i)
                    {
                        difficulty = Math.abs(rock[j] - rock[j+2]);
                        j += 2;
                    }
                    else
                    {
                        difficulty = Math.max(Math.abs(rock[j] - rock[j+1]),difficulty);
                        j++;
                    }
                }
                  if(i == 1) minDifficulty = difficulty;
                  else minDifficulty = Math.min(difficulty,minDifficulty);
            }
            System.out.println(minDifficulty);
	}
}

import java.util.Scanner;

public class Climb {
    public static void main(String[] args) {
        Scanner n = new Scanner(System.in);
        int holds=n.nextInt();
        int line [] = new int [10000];
        for (int i = 0; i <holds; i++) {
            int l = n.nextInt();
            line[i]=l;
        }
        int min=100000000;
        for (int i = 1; i <holds-1; i++) {
            if(line[i+1]-line[i-1]<min)
                min=line[i+1]-line[i-1];
        }
        System.out.println(min);
    }
}

import java.util.*;
public class MinimumDifficulty
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n;
		n=sc.nextInt();
		int ar[]=new int[n];
		for(int i=0;i<n;i++)
		{
			ar[i]=sc.nextInt();
		}
		int max=0,k=0;
		int result[]=new int[100];
		for(int i=0;i<n-1;i++)
		{
			int m=i+1;
			int diff;
			for(int j=0;j<n-1;j++)
			{
				if(j+1==m)
					continue;
				else if(j==m)
				{
					diff=ar[j+1]-ar[j-1];
					if(max<diff)
					{
						max=diff;
					//	result[k++]=max;
					}

				}
				else
				{
					diff=ar[j+1]-ar[j];
					if(max<diff)
					{
						max=diff;

					}
				}
			}
				result[k++]=max;
		}
		int min=result[0];
		for(int i=1;i<k;i++)
		{
			if(min>result[i])
				min=ar[i];
		}
		System.out.println(min);
		}
}

/*
ID: benkhad2
PROG : modular
LANG: JAVA
TASK: Modular Equations
*/
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class minimum {
  public static void main (String [] args) throws IOException {
	Scanner read = new Scanner(System.in);
	int n = Integer.parseInt(read.nextLine());
	String t[] = read.nextLine().split(" ");

	if(n==3){
		System.out.println(Integer.parseInt(t[n-1])-Integer.parseInt(t[0]));
	}else{
		int d=1000;
		for(int i=1;i<n-1;i++){
			int max=0;
			int j=n-1;
			while(j>0){
				int amax=0;
				if(j==i){
					j-=2;;
				}else{
					if(j-1==i){
						amax=Integer.parseInt(t[j])-Integer.parseInt(t[j-2]);
					}else{
						amax=Integer.parseInt(t[j])-Integer.parseInt(t[j-1]);
					}
					if(amax>max){
						max=amax;
					}
					j--;
				}
			}
			if(max<d){
				d=max;
			}
		}
		System.out.println(d);
	}

    System.exit(0);

  }

}

import java.util.Scanner;

public class Climb {
    public static void main(String[] args) {
        Scanner n = new Scanner(System.in);
        int holds=n.nextInt();
        int line [] = new int [10000];
        for (int i = 0; i <holds; i++) {
            int l = n.nextInt();
            line[i]=l;
        }
        int min=0;
        int min1=100000000;
        for (int i = 1; i <holds-1; i++) {
            for(int j=0;j<holds-1;j++){
                if(j==i-1){
                    if(line[j+2]-line[j]>min)
                        min=line[j+2]-line[j];
                }
                else{
                    if(line[j+1]-line[j]>min)
                        min=line[j+1]-line[j];
                }
            }
            if (min<min1)
                min1=min;
        }
        System.out.println(min1);
    }

}

import java.util.Scanner;

public class A {

    public static void main(String[] args){

        A a = new A();

        a.solve();

    }

    public void solve(){

        Scanner s = new Scanner(System.in);

        int[] d = new int[105];

        int h = s.nextInt();
        int i =  1;
        d[0] = 0;
        int curDiff = 0;
        while (i <= h){

            d[i] = s.nextInt();
            curDiff = Math.max(curDiff, d[i] - d[i-1]);
            i++;

        }

        int min = Math.max(curDiff, d[3] - d[1]);
        for(int j = 3; j< h; j++){

            int cur = Math.max(curDiff, d[j+1] - d[j-1]);
            min = Math.min(cur, min);
        }
        System.out.println(min);
        s.close();
    }

}

import java.util.*;
public class watermelon {
	public static void main(String[] args){

		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int arr[] = new int[n];
		int temp = 0;
		int max = Integer.MIN_VALUE;

		for(int i=0; i<n;i++) {
			arr[i] =s.nextInt();
			if(arr[i]-temp>max) {
				max = arr[i] -temp;
			}
			temp = arr[i];
		}
		int max1 = Integer.MIN_VALUE;
		for(int i=1 ;i<n-1;i++) {
			if(arr[i+1]-arr[i-1]>max1) {
				max1 = arr[i+1]-arr[i-1];
			}
		}
		if(n==3) {
			System.out.println(arr[2]-arr[0]);
		}else {
			System.out.println(Math.min(max, max1));
		}

	}
}

import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Dell
 */
public class NewMain56 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here+
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();

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

        if (n == 3) {
            System.out.println(ar[2] - ar[0]);
            return;
        }
        int max = Integer.MIN_VALUE;

        for (int i = 2; i < n ; i++) {
            if (i == 2) {
                max = Math.max(max, ar[2] - ar[0]);
            } else {
                max = Math.max(max, ar[i] - ar[i - 1]);
            }

        }
        System.out.println(max);
    }

}

import java.util.*;
public class MinimumDifficulty {
    public static void main(String[]args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int arr[] = new int[n];
        for(int i=0;i<n;i++){
            arr[i]=in.nextInt();
        }

        int mn = 100000000 , mx = 0;
        for(int i=1;i<n;i++){
            mx = Math.max(mx, arr[i] - arr[i]);
            if(i > 1){
                mn = Math.min(mn, arr[i] - arr[i-2]);
            }
        }
        System.out.print(Math.max(mn , mx));
    }
}

import java.util.*;

public class A496 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), smallest = 2, first = 2;
		List<Integer> w = new ArrayList<Integer>();
		for(int i = 0; i < n ; i++)
			w.add(in.nextInt());

		if(n > 3)
		{
			for(int i = 1; i < (n-1); i++)
			{
				int t = w.remove(i);
				for(int r = 0; r < w.size()-1; r++)
				{
					if(i == 1)
					{
						int z = w.get(r+1) - w.get(r);
						if(z > smallest)
							first = w.get(r+1) - w.get(r);
					}
					else
					{
						if((w.get(r+1) - w.get(r)) > first)
							smallest = w.get(r+1) - w.get(r);
					}
				}
				w.add(i, t);
			}
		}
		else
			first = w.get(2) - w.get(0);
		System.out.println(first);
	}
}

import java.util.*;
import java.lang.*;

/**
 *
 * @author greggy
 */
public class MinimumDifficulty {

    public static void main(String[] args) {
        int ans = 0;
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] holds = new int[n];

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

        int megamax = Integer.MAX_VALUE;
        int max = 0;

        for (int i = 1; i < n - 1; i++) {
            max = 0;

            for (int j = 0; j < n - 1; j++) {
                int next = j + 1;
                if (next == i) {
                    next++;
                }
                max = Math.max(max, holds[next] - holds[j]);

            }
            ans = Math.min(megamax, ans);
        }

        System.out.println(ans);
        in.close();
    }

}

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,min=200;
		for(int j=0;j<n;j++){
		    a[j]=sc.nextInt();
		    if(j>0){
		        if(a[j]-a[j-1]>max){
		            max=a[j]-a[j-1];
		        }
		    }
		    if(j>1){
		        if(a[j]-a[j-2]<min){
		            min=a[j]-a[j-2];
		        }
		    }
		}
		if(min>max){
		    System.out.println(min);
		}
		else{
		    System.out.println(max);
		}
	}
}

import java.util.Scanner;
/**
 * Created by Admin on 12/17/2014.
 */
public class a {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nums = new int[n];
        for(int i = 0; i < n; i++){
            nums[i] = sc.nextInt();
        }
        int min = 1000000;
        int max = 0;
        for(int i = 0 ; i < n-2; i++){
            if(nums[i+2]-nums[i] < min){
                min = nums[i+2]-nums[i];
                max = Math.max(max, min);
            } else {
                max = Math.max(max, nums[i + 1] - nums[i]);
            }
        }
        System.out.println(max);
    }
}

import java.util.*;
public class MinimumDifficulty
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n;
		n=sc.nextInt();
		int ar[]=new int[n];
		for(int i=0;i<n;i++)
		{
			ar[i]=sc.nextInt();
		}
		int max=0,k=0;
		int result[]=new int[100];
		for(int i=0;i<n-1;i++)
		{
			int m=i+1;
			int diff;
			for(int j=0;j<n-1;j++)
			{
				if(j+1==m)
					continue;
				else if(j==m)
				{
					diff=ar[j+1]-ar[j-1];
					if(max<diff)
					{
						max=diff;
					//	result[k++]=max;
					}

				}
				else
				{
					diff=ar[j+1]-ar[j];
					if(max<diff)
					{
						max=diff;

					}
				}
			}
				result[k++]=max;
		}
		int min=result[0];
		for(int i=1;i<k;i++)
		{
			if(min>result[i])
				min=result[i];
		}
		System.out.println(min);
		}
}

import java.util.Scanner;
public class cdf{
        public static void main(String[] args) {
            int n;
            int a[];
            Scanner in = new Scanner(System.in);
            n = in.nextInt();
            a = new int[n];
            int min = 1001;
            int min_ind=0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                if ((i > 1) && (a[i]-a[i-1])<min){min=a[i]-a[i-1]; min_ind=i-1;}
            }
            a[min_ind]=a[min_ind+1];
                int max=0;
                for (int i = 1; i < n; i++)
                if(a[i]-a[i-1]>max) max=a[i]-a[i-1];
            System.out.println(max);

            }
        }

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class MinimumDifficulty {

	private static List<Integer> takeInput(){
		Scanner scan= new Scanner(System.in);
		int n=Integer.parseInt(scan.nextLine());
		List<Integer> input=new ArrayList<>(n);
		for(int i=0;i<n;i++) {
			input.add(scan.nextInt());
		}
		return input;
	}
	private static int findMinDifficult(List<Integer> input) {
		int min=Integer.MIN_VALUE;
		for(int i=1;i<input.size()-1;i++) {
			int removedIndex=1;
			List<Integer>difficultList=new ArrayList<>();
			difficultList.add(input.get(0));

			for(int j=1;j<input.size()-1;j++) {
				if(j!=removedIndex) {
					difficultList.add(input.get(j));
				}
			}
			difficultList.add(input.get(input.size()-1));
			for(int j=0;j<difficultList.size()-1;j++) {
				int subtract=difficultList.get(j+1)-difficultList.get(j);
				if(subtract>min) {
					min=subtract;
				}
			}
			removedIndex++;
		}
		return min;
	}
	public static void main(String[] args) {
		List<Integer>input=takeInput();
		int min=findMinDifficult(input);
		System.out.println(min);

	}

}

import java.util.*;

public class Main {
    public static void main(String[] args) {
        // write your code here
        Scanner sc= new Scanner(System.in);
        int n=sc.nextInt();
        int[] nums=new int[n];
        for (int i = 0; i <n ; i++) {
         nums[i]=sc.nextInt();
        }
        int min=Integer.MAX_VALUE;
        int max=0;
        for (int i = 1; i <n-1 ; i++) {
            for (int j = 1; j<n; j++) {
                if((j-1)==i&&(j-2)>=0){
                    max=nums[j]-nums[j-2]>max?nums[j]-nums[j-2]:max;
                }else{
                    max=nums[j]-nums[j-1]>max?nums[j]-nums[j-1]:max;
                }
            }
            min=max<min?max:min;
        }
        System.out.println(min);
    }
}

import java.util.*;
import java.lang.*;

public class A283 {
	public static void main(String[] args) {
		Scanner scan = new Scanner (System.in);

		int num = scan.nextInt();

		int[] data = new int[num];

		data[0] = scan.nextInt();
		int difference = 0; int sub;
		for (int i = 1; i < num; i++) {
			data[i] = scan.nextInt();
			sub = data[i] - data[i-1];
			if (sub > difference) {
				difference = sub;
			}
		}

		for (int i = 2; i < num; i++) {
			sub = data[i] - data[i-2];
			if (sub > difference) {
				difference = sub;
			}
		}
		System.out.println(difference);
	}
}

import java.util.Map;
import java.util.Scanner;

public class AlgorithmsExcersises {

    public static Scanner sc = new Scanner(System.in);
    public static int n;
    public static int[] height;

    public static void main(String[] Args) {
        n=sc.nextInt();
        int min=1000;
        height=new int[n];
        for(int i =0;i<n;i++)
            height[i]=sc.nextInt();

        int difficulty=0;
        //find difficulty
        for(int i=1;i<n;i++)
            if(height[i]-height[i-1]>difficulty)
                difficulty=height[i]-height[i-1];

        for(int i=1;i<n-1;i++){
            int candidate=height[i+1]-height[i-1];
            if(candidate>difficulty&&candidate<min)
                min=candidate;
        }
        System.out.println(min);

    }
}

import java.util.Scanner;

public class A {
    public static void main(String args[]){
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int a[] = new int[n];
            for(int i = 0 ; i < n ; i++)
                a[i] = in.nextInt();
            int val = 0 , ind = 1 , cavap = 1001;
            for(int j = 0 ; j < n ; j++){
                for(int i = 0 ; i < n ; i++){
                    if(i==ind-1){
                        if(i<n-2)
                            if(val<a[i+2]-a[i])
                                val = a[i+2]-a[i];
                    }else{
                        if(i<n-1)
                            if(val<a[i+1]-a[i])
                                val = a[i+1]-a[i];
                    }
                }
                ind++;
                if(val<cavap)
                    cavap = val;
            }
            System.out.println(cavap);
    }
}

import java.util.*;
public class hello {
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[105];
		int _max = 0;
		int temp = 0;
		for (int i = 0; i < n; ++i) {
			a[i] = scan.nextInt();
			if (i != 0)
				_max = Math.max(_max, a[i] - a[i - 1]);
		}
		int ans = 100000;
		for (int i = 2; i < n; ++i) {
			temp = a[i] - a[i - 2];
			if (temp > _max) {
				ans = Math.min(ans, temp);
			}
		}
		System.out.println(ans);
	}
}

import java.util.*;
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner in=new Scanner(System.in);
	    int n=in.nextInt();
	    int a[]=new int[n];
	    int max=0,min=0;
	    for(int i=0;i<n;i++)
	        a[i]=in.nextInt();
	    for(int i=1;i<n-1;i++){
	        int diff=a[i]-a[i-1];
	        if(diff>max)
	            max=diff;
	    }
	    min=a[2]-a[0];
	    for(int i=2;i<n-1;i++){
	        int diff=a[i+1]-a[i-1];
	        if(diff<min)
	            min=diff;
	    }
	    System.out.println(Math.max(max,min));
    }
}

import java.util.Scanner;
import java.util.LinkedList;
public class main
{
    public static void main(String args[])
    {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int arr[] = new int[n];
        int f[] = new int[n];
        int a[] = new int[n-2];
        for(int i=0;i<n;i++)
        {
            arr[i] = input.nextInt();
            f[i] = arr[i];
        }
        int k = 0;
        for(int i=1;i<n-1;i++)
        {
            f[i] = f[i+1];
            int max = Integer.MIN_VALUE;
            for(int j=1;j<n-1;j++)
            {
                if(f[j] - f[j-1] > max)
                {
                    max = f[j] - f[j-1];
                }
            }
            a[k++] = max ;
            f[i] = arr[i];
//          System.out.println(max);
        }
        int min = Integer.MAX_VALUE;
        for(int i=0;i<a.length;i++)
        {
            if(a[i] < min)
            {
                min = a[i];
            }
        }
        System.out.println(min);
    }
}

import java.util.Scanner;
public class MinimumDifficulty {
	public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt(),min=100,max=-1;
int[] arr=new int[n];
for(int i=0;i<n;i++) {
	arr[i]=sc.nextInt();
}
for(int k=1;k<n;k++) {
for(int i=1;i<n-1;i++) {
	if(i==k && max<arr[i+1]-arr[i-1])
	max=arr[i+1]-arr[i-1];
	else if(i-1==k && max<arr[i]-arr[i-2])
		max=arr[i]-arr[i-2];
else if(max<arr[i]-arr[i-1])
	max=arr[i]-arr[i-1];
	}
if(min>max)
	min=max;
}
System.out.println(min);
}
}

import java.util.Scanner;

public class find_d {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] ar = new int[n];
        for (int i = 0; i < n; i++) {
            ar[i] = in.nextInt();
        }
        int d = 0;
        int arr[] = new int[n-2];
        for(int i=1;i<n-1;i++) {
            for(int j=0;j<n-1;j++) {
                if ((j + 1 != i) && (j != i)) {
                    if (d < ar[j + 1] - ar[j]) d = ar[j + 1] - ar[j];
                } else {
                    if (j + 1 == i) {
                        if (ar[j + 2] - ar[j] > d) d = ar[j + 2] - ar[j];
                    }
                }
                arr[i-1] =d;
            }
        }
        int g = arr[0];
        for(int i =0;i<n-2;i++) {
            if (arr[i]< g) g = ar[i];
        }
        System.out.println(g);
    }
}

import java.io.*;
import java.util.*;

public class Numbers
{
      public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());

            int minDifficulty = -1, difficulty = -1;
            int n = Integer.parseInt(st.nextToken());
            int[] rock = new int[n];
            st = new StringTokenizer(br.readLine());
            for(int i=0; i<n; i++)
                  rock[i] = Integer.parseInt(st.nextToken());

            for(int i=1; i<n-1; i++)
            {
                for(int j=0; j<n-1;)
                {
                    if(j+1 == i)
                    {
                        difficulty = Math.abs(rock[j] - rock[j+2]);
                        j += 2;
                    }
                    else
                    {
                        difficulty = Math.max(Math.abs(rock[j] - rock[j+1]),difficulty);
                        j++;
                    }
                }
                  if(i == 1) minDifficulty = difficulty;
                  else minDifficulty = Math.min(difficulty,minDifficulty);
            }
            System.out.println(minDifficulty);
	}
}

import java.util.*;
/**
 *
 * @author Annie
 */
public class Diff {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner s =  new Scanner(System.in);
        int n = s.nextInt();
        int a[] = new int[n];
         int arr[] = new int[n];
        for(int i=0;i<n;i++){
        a[i]=s.nextInt();
        }

        int i=1;
        while(i<=n-2){

        String nstr="";

        for(int j=0;j<n;j++){
        if(j!=i){
        nstr = nstr + a[j];
        }
        }
         //System.out.println(nstr);
         int max =nstr.charAt(1)-nstr.charAt(0);
        for(int k=0;k<nstr.length()-1;k++){

         int y = nstr.charAt(k+1)-nstr.charAt(k);
         if(y>max)   {
         max=y;
         }

        }
      arr[i]=max;
        //System.out.println(max);
        i++;
        }//while closed
        int min = arr[1];
        for(int l=0;l<n;l++){
        if(arr[l]>0 && arr[l]<min){
        min=arr[l];
        }

        }

        System.out.println(min);
    }

}

import java.io.*;
import java.util.*;
public class task{
    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();
        int high=a[0];
        int max[]=new int[n-2];
        int t=0;
        for(int i=1;i<n-1;i++){
            int d=a[i];
            int b[]=new int[n-1];
            b[0]=a[0];
            b[n-2]=a[n-1];
            int c=1;
            for(int j=1;j<n-2;j++,c++){
                if(a[c]==d){
                    j--;
                    continue;
                }
                else{
                    b[j]=a[c];
                    //c++;
                }
            }

            for(int j=0;j<n-2;j++){
                int diff= b[j+1]-b[j];
                if(diff>high)
                    high=diff;
            }
            max[t++]=high;
        }
        int low=max[0];
        for(int i=0;i<n-2;i++){
            if(max[i]<low)
                low = max[i];
        }
        System.out.print(low);
    }
}

import java.io.*;
import java.util.*;

public class Cf496A {

    public static void main(String args[]) throws IOException
    {
        InputReader in = new InputReader(System.in);
	PrintWriter w = new PrintWriter(System.out);
        int n = in.nextInt();
        int[] a = in.nextIntArray(n);
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;

        for(int i = 1 ; i < n-1 ; i++){
            int[] newa = new int[n-1];
            for(int j = 0, k = 0; j < n; j++){
                if(j == i) {
                    continue;
                }
                else{
                    newa[k] = a[j];
                    k++;
                }
            }
            for(int j = 1; j < n-1; j++){
                max = Math.max(max, newa[j] - newa[j-1]);
            }
            min = Math.min(min, max);
        }
        w.println(min);
        w.close();
    }

      static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}

import java.util.Scanner;
import java.lang.*;
import java.io.*;

public class S
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n;
		n = sc.nextInt();
		int a[] = new int[n];
		for(int i=0; i<n; i++)
			a[i] = sc.nextInt();

		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		for(int i=1; i<=n-2; i++){
			for(int j=1; j<=n-1; j++){
				int d;
				if(i==j){
					d = a[j+1]-a[j-1];
				}else{
					d = a[j]-a[j-1];
				}
				if(max<d)
				max=d;
			}
			if(min>max)
			min=max;
		}
		System.out.println(min);
	}
}

import java.util.*;

public class _496A_Minimum_Difficulty {
    public static void main(String[] args) {
	Scanner in = new Scanner(System.in);

	int n = in.nextInt();
	int[] a = new int[n];
	for (int i = 0; i < n; i++)
	    a[i] = in.nextInt();
	int[] diff = new int[n - 1];
	for (int i = 1; i < n; i++)
	    diff[i - 1] = Math.abs(a[i] - a[i - 1]);

	int max = diff[0];
	int maxIndex = 0;
	for (int i = 0; i < diff.length; i++)
	    if (max < diff[i]) {
		max = diff[i];
		maxIndex = i;
	    }

	int[] rem = new int[n - 2];
	for (int i = 1; i < n - 1; i++)
	    rem[i - 1] = Math.abs(diff[i] + diff[i - 1]);
	int min = rem[0];
	int minIndex = 0;
	for (int i = 0; i < rem.length; i++)
	    if (min > rem[i]) {
		min = rem[i];
		minIndex = i;
	    }

	if (max > min)
	    System.out.println(max);
	else if (Math.abs(minIndex + 0.5 - maxIndex) < .6)
	    System.out.println(min);

    }
}

import java.util.*;
import java.io.*;
//1352B
public class Parity{
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++){
            arr[i] = sc.nextInt();
        }

        int k = 0, diff = 0;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        for (int i = 1; i < n-1; i++){
            for (int j = 0; j < n-1; j++){
                //System.out.println("i = "+i+" j ="+j);
                if(i == j+1){
                    k = j+2;
                    if(k < n) diff = arr[k]-arr[j];
                    j++;
                }
                else{
                    k = j+1;
                    diff = arr[k]-arr[j];
                }
                max = Math.max(diff, max);
            }
            min = Math.min(min, max);
        }
        System.out.println(min);
    }

    public static void printarr(int[] arr){
        for (int i = 0; i < arr.length; i++){
            System.out.print(arr[i]+" ");
        }
        System.out.println();
    }

    public static class FastScanner{
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(){
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try{
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong(){
            return Long.parseLong(next());
        }

        double nextDouble(){
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try{
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.util.Scanner;

public class Skalolaz {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int a1=in.nextInt(), a2=in.nextInt(), a3=in.nextInt();
        int[] b = new int[n-2];
        b[0]=a3-a1;
        int max=a2-a1;
        int maxx=a3-a1;
        for(int i=3; i<n; i++){
            a1=a2;
            a2=a3;
            a3=in.nextInt();
            if(a2-a1>max){
                max=a2-a1;
            }
            if(a3-a1>maxx){
                maxx=a3-a1;
            }
            b[i-2]=a3-a1;
        }
        System.out.println((max+maxx)/2);
    }
}

import java.io.*;
import java.util.*;

 public class A{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine()," ");
        int[] a = new int[n];
        for (int i=0; i < n; i++){
            a[i] = Integer.parseInt(st.nextToken());
        }
        int[] d = new int[n-1];
        for (int i=0; i < n-1; i++){
            d[i] = a[i+1] - a[i];
        }
        int mind = Integer.MAX_VALUE;
        for (int i=0; i < n-2;i++){
            d[i] = d[i] + d[i+1];
         int maxd = 0;
            for (int j=0; j < n-1; j++){
                if (d[j] > maxd){
                    maxd = d[j];
                }
            }
            if (maxd < mind){
                mind = maxd;
            }
        }
        System.out.println(mind);

    }
}

import java.util.Arrays;
import java.util.Scanner;

public class MinimumDifficulty {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int test=s.nextInt(),x,y=0,z;
        int arr[]=new int[test];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=s.nextInt();
        }
        x=arr[test-1];
        z=arr[0];
        //int arr1[]=new int [test-1];
        for (int i = 1; i < arr.length-1; i++) {
            if((arr[i+1]-arr[i-1])<x){
                x=arr[i+1]-arr[i-1];
                y=i;
            }
        }
        arr[y]=0;
        Arrays.sort(arr);
        for (int i = 1; i < arr.length-1; i++) {
            if((arr[i+1]-arr[i])>z){
                z=arr[i+1]-arr[i];
            }
        }
        System.out.println(z);
    }

}

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;

public class D2_283A {
	public static void main(String[] args) {
		try (Scanner scan = new Scanner(System.in)) {
			int N = Integer.parseInt(scan.nextLine());
			StringTokenizer st = new StringTokenizer(scan.nextLine());
			int pr = n(st);
			List<Integer> diff = new ArrayList<>();
			for (int i = 1; i < N; i++) {
				int t = n(st);
				diff.add(t - pr);
				pr = t;
			}
			int min = diff.get(0) + diff.get(1);
			for (int i = 1; i < N - 2; i++) {
				min = Math.min(min, diff.get(i) + diff.get(i + 1));
			}
			System.out.println(diff);
			System.out.println(min);
		}
	}

	static int n(StringTokenizer st) {
		return Integer.parseInt(st.nextToken());
	}
}

import java.util.*;

public class CF {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int [] a = new int [n+1];
		int [] sum = new int [n+1];
		for(int i = 0 ; i < n  ; i++){
			a[i] += in.nextInt();
		}
		int mn = Integer.MAX_VALUE;
		int mni = -1;
		for(int i = 1 ;i < n ; i++){
			sum[i]= a[i] - a[i-1];
			if(a[i] < mn){
				mn = sum[i];mni = i ;

			}

		}
		sum[mni+1] += mn ;
		sum[mni] = Integer.MIN_VALUE;
		mni = Integer.MIN_VALUE ;
		for(int i = 1 ;i < sum.length ; i++){
			mni=Math.max(sum[i], mni);
		}

		System.out.print(mni);

	}
}

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;

/*
  br = new BufferedReader(new FileReader("input.txt"));
  pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
  br = new BufferedReader(new InputStreamReader(System.in));
  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
	private static BufferedReader br;
	private static StringTokenizer st;
	private static PrintWriter pw;

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		//int qq = 1;
		int qq = Integer.MAX_VALUE;
		//int qq = readInt();
		for(int casenum = 1; casenum <= qq; casenum++) {
			int n = readInt();
			int[] list = new int[n];
			for(int i = 0; i < n; i++) {
				list[i] = readInt();
			}
			int ret = 0;
			for(int i = 1; i < n-1; i++) {
				ArrayList<Integer> temp = new ArrayList<Integer>();
				for(int a = 0; a < n; a++) {
					if(a==i) continue;
					temp.add(list[a]);
				}
				for(int a = 0; a < temp.size()-1; a++) {
					ret = Math.max(ret, temp.get(a+1) - temp.get(a));
				}
			}
			pw.println(ret);
		}
		exitImmediately();
	}

	private static void exitImmediately() {
		pw.close();
		System.exit(0);
	}

	private static long readLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private static double readDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	private static int readInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	private static String nextLine() throws IOException  {
		if(!br.ready()) {
			exitImmediately();
		}
		st = null;
		return br.readLine();
	}

	private static String nextToken() throws IOException  {
		while(st == null || !st.hasMoreTokens())  {
			if(!br.ready()) {
				exitImmediately();
			}
			st = new StringTokenizer(br.readLine().trim());
		}
		return st.nextToken();
	}
}

import java.io.*;
import java.util.*;
import java.math.*;
public class btjava {

	public static void main(String[] args) throws Exception{
		int n;
		n=rInt();
		int a[] = new int[200];
		int b[] = new int[200];
		for(int i=1;i<=n;i++)
			a[i]=rInt();
		int temp;
		int result=Integer.MAX_VALUE;
		for(int i=2;i<=n-2;i++)
		{
			temp=Integer.MIN_VALUE;
			for(int j=1;j<=n-2;j++)
			{
				if(j==i)
					temp=Math.max(temp, Math.abs(a[j-1]-a[j+1]));
				else
					temp=Math.max(temp, Math.abs(a[j]-a[j+1]));
			}
			b[i]=temp;
		}
		for(int i=2;i<=n-2;i++)
			result=Math.min(result, b[i]);
		System.out.println(result);
	}

	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st = new StringTokenizer("");
	static String rStr() throws Exception{
		while(!st.hasMoreTokens())
		{
			st=new StringTokenizer(br.readLine());
		}
		return st.nextToken();
	}
	static int rInt() throws Exception
	{
		return Integer.parseInt(rStr());
	}

}

//package com.example.hackerranksolutions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

public class CodeforcesProblems {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        int[] arr = new int[n];
        int min = 100001;

        for(int i = 0; i<n; i++) {
            arr[i] = in.nextInt();
        }
        int max = -1;
        int pos = -1;
        for(int i = 1; i<n-1; i++) {
            int prevDist = arr[i] - arr[i-1];
            if(prevDist>max) {
                max = prevDist;
            }
            int dist = arr[i+1] - arr[i-1];
            if(dist<min) {
                min = dist;
                pos = i;
                if(max<min) {
                    max = min;
                }
            }
        }
        if(pos != n-2) {
            int x = arr[n-1] - arr[n-2];
            if(max<x) max = x;
        }
        System.out.println(max);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Solution implements Runnable {
  BufferedReader in;
  PrintWriter out;
  StringTokenizer tok = new StringTokenizer("");

  @Override
  public void run() {
    init();
    long time = System.currentTimeMillis();
    try {
      solve();
    } catch (IOException e) {
      e.printStackTrace();
    }
    out.close();
    System.err.println(System.currentTimeMillis() - time);
  }

  private void init() {
    in = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);
  }

  public static void main(String[] args) {
    new Thread(new Solution()).start();
  }

  private String readString() {
    while (!tok.hasMoreTokens()) {
      try {
        tok = new StringTokenizer(in.readLine());
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    return tok.nextToken();
  }

  private int readInt() {
    return Integer.parseInt(readString());
  }

  private void solve() throws IOException {
    int n = readInt();
    int minDiff = Integer.MAX_VALUE;
    int[] ar = new int[n];
    for (int i = 0; i < n; i++) {
      ar[i] = readInt();
    }
    for (int i = 1; i < n-1; i++) {
      int removed = i;
      ArrayList<Integer> created = new ArrayList<>();
      for (int j = 0; j < n; j++) {
        if(j!=removed) created.add(ar[j]);
      }
      for (int j = 0; j < created.size() - 1; j++) {
        minDiff = Math.min(Math.abs(created.get(j+1)-created.get(j)), minDiff);
      }
    }
    out.print(minDiff);
  }

}

import java.lang.Math;
import java.util.*;
public class Codeforces {
    public static void main(String[] args) {
        Scanner in =new Scanner(System.in);
        int[] arr=new int[1000];
        int[] brr=new int[1000];
        int n;
        n=in.nextInt();
        for(int i=0;i<n;++i)
            arr[i]=in.nextInt();
        int c=0;
        for(int i=1;i<n-1;++i){
            int max=arr[i+1]-arr[0];
            for(int j=i+1;j<n;++j){
                if(arr[j]-arr[j-1]>max)
                    max=arr[j]-arr[j-1];
            }
            brr[c]=max;
            c++;
        }
        int min=100000;
        for(int i=0;i<c;++i)
            if(brr[i]<min)
                min=brr[i];
      System.out.println(min);
    }
}

import java.util.Scanner;

public class MinimumDifficulty {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int fmax;
        int ans=0;
        int[]a=new int[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        fmax=a[2]-a[0];
        for(int i=0;i<n-2;i++){
            int max=a[i+2]-a[i];
             ans=Math.min(fmax,max);
        }
        int diff2=0;
        for(int i=0;i<n-1;i++){
            diff2=Math.max(diff2,a[i+1]-a[i]);
        }
        System.out.println(Math.max(ans,diff2));

    }
}

import java.util.*;

public class problema3 {
    public static void main(String []args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();

        for(int i = 0; i < n; i++)
            list.add(sc.nextInt());

        int minim = n * n;
        int maxim = 0;

        for(int i = 0; i < n - 2; i++) {
            minim = Math.min(minim, list.get(i+2) - list.get(i));
        }

        for(int i = 0; i < n - 1; i++)
            maxim = Math.max(maxim, list.get(i+1) - list.get(i));

        System.out.println(Math.max(minim, maxim));
    }
}