namespace topCoder
{
	using System;
	using System.Collections.Generic;

	class p1
	{
		public void foo()
		{
			int n = int.Parse(Console.ReadLine());
			string[] sp = Console.ReadLine().Split(' ');
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = int.Parse(sp[i]);
			}

			int soFar = int.MaxValue;
			for (int i = 1; i < n - 1; i++)
			{
				int t = 0;
				int[] b = new int[n-1];
				for (int j = 0; j < n; j++)
				{
					if (j == i) continue;
					b[t] = a[j];
					t++;
				}
				soFar = Math.Min(soFar, diff(b));
			}
			Console.WriteLine(soFar);
		}
		private int diff(int[] a)
		{
			int d = int.MinValue;
			int n = a.Length;
			for (int j = 0; j < n - 1; j++)
			{
				d = Math.Max(d, a[j + 1] - a[j]);
			}
			return d;
		}
		static void Main(string[] args)
		{
			p1 o = new p1();
			o.foo();

			//Console.ReadLine();
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();

            int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();
            int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();

            Console.WriteLine(Math.Max(max1, min2));
            String test = Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;

namespace MinimumDifficulty
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string [] input = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.None);

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

            int k = 1;
            int result = int.MaxValue;
            while(k<n-1){
                List<int> tmpA = new List<int>();
                for(int i=0; i<n; i++){
                    if (k!=i){
                        tmpA.Add(a[i]);
                    }
                }
                int tmp = int.MinValue;
                for (int i=0; i<tmpA.Count-1; i++){
                    tmp = Math.Max(tmp, Math.Abs(tmpA[i] - tmpA[i+1]));
                }
                result = Math.Min(result, tmp);
                k++;
            }

            Console.WriteLine(result);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication6
{

    class Program
    {
        static void Main(string[] args)
        {
            int n;
            int min;
            string str1;
            n = Convert.ToInt32(Console.ReadLine());
            int[] trass = new int[n];
            int[] razn1 = new int[n - 1];
            int[] razn2 = new int[n - 2];
            int[,] razn2d = new int[n - 2, n - 2];
            int[] max = new int[n - 2];
            str1 = Console.ReadLine();
            string[] strin1 = str1.Split(' ');
            for (int i = 0; i < n; i++)
            {
                trass[i] = int.Parse(strin1[i]);
            }
            for (int i = 0; i < n - 1; i++)
            {
                razn1[i] = trass[i + 1] - trass[i];

            }
            for (int i = 0; i < n - 2; i++)
            {
                razn2[i] = trass[i + 2] - trass[i];

            }

            for (int i = 0; i < n - 2; i++) {
                for (int j = 0; j < n - 2; j++) {
                    if (j == i) { razn2d[i, j] = razn2[j]; };
                    if (j > i) { razn2d[i, j] = razn1[j + 1]; }
                    else if(i!=j) { razn2d[i, j] = razn1[j]; }

                }
            }
            for (int i = 0; i < n - 2; i++) { max[i] = 0; }
            for (int i = 0; i < n - 2; i++) {
                for (int j = 0; j < n - 2; j++) {
                    if (razn2d[i, j] > max[i]) { max[i] = razn2d[i, j]; }

                }
            }
            min = max[0];
            for (int i = 0; i < n - 2; i++) {
                if (max[i] <= min) { min = max[i]; }

            }

            Console.WriteLine(min);

            Console.ReadLine();

        }
    }
}

using System;
class Program
    {
        public static void Main(string[] args)
        {
            int[] data;
            {
                string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\r', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                data = new int[input.Length];
                for (int i = 1; i < data.Length; ++i)
                    data[i] = int.Parse(input[i]);
            }
            int maxDistance = 0;
            for (int i = 2; i < data.Length; ++i)
              if (data[i] - data[i - 1] > maxDistance)
               maxDistance = data[i] - data[i - 1];
            int minMax = int.MaxValue;
            for(int i = 3,curr; i<data.Length; ++i)
            {
                curr = data[i] - data[i - 2];
                if (curr < minMax) minMax = curr;
            }
            Console.WriteLine(maxDistance < minMax ? minMax : maxDistance);
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;

namespace MinimumDifficulty
{
    partial class MinimumDifficulty
    {
        static void Main(string[] args)
        {
            int n, max, diff;
            int[] holds;
            List<int> maximums = new List<int>();

            n = NextInt();
            holds = new int[n];

            for (int i = 0; i < n; i++)
                holds[i] = NextInt();

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

                for (int j = 1; j < n; j++)
                {
                    if (j == i)
                        diff = holds[j + 1] - holds[j - 1];
                    else if (j - 1 == i)
                        diff = holds[j] - holds[j - 2];
                    else
                        diff = holds[j] - holds[j - 1];

                    if (diff > max)
                        max = diff;
                }

                maximums.Add(max);
            }

            Console.WriteLine(maximums.Min());
        }
    }

    partial class MinimumDifficulty
    {
        static string[] tokens = new string[0];
        static int cur_token = 0;

        static void ReadArray(char sep)
        {
            cur_token = 0;
            tokens = Console.ReadLine().Split(sep);
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int NextInt()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return int.Parse(tokens[cur_token++]);
        }

        static long NextLong()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return long.Parse(tokens[cur_token++]);
        }

        static double NextDouble()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return double.Parse(tokens[cur_token++]);
        }

        static decimal NextDecimal()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return decimal.Parse(tokens[cur_token++]);
        }

        static string NextToken()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return tokens[cur_token++];
        }

        static string ReadLine()
        {
            return Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Debug = System.Diagnostics.Debug;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Solver
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var a = sc.Integer(n);
            int max=-1;
            for (int i = 1; i < n; i++)
                max = Math.Max(max, a[i] - a[i - 1]);
            var min = int.MaxValue;
            for (int i = 1; i < n - 1; i++)
                min = Math.Min(min, a[i + 1] - a[i-1]);
            IO.Printer.Out.WriteLine(Math.Max(min, max));
        }

        internal IO.StreamScanner sc;
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }
    }

    #region Main and Settings
    static class Program
    {
        static void Main(string[] arg)
        {
#if DEBUG
            var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
            Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream"));
            Debug.AutoFlush = false;
            var sw = new Watch(); sw.Start();
            IO.Printer.Out.AutoFlush = true;
            try
            {
#endif

                var solver = new Solver();
                solver.sc = new IO.StreamScanner(Console.OpenStandardInput());
                solver.Solve();
                IO.Printer.Out.Flush();
#if DEBUG
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds);
                Debug.Close();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
#endif
        }

    }
    #endregion
}

#region IO Helper
namespace Solver.IO
{
    public class Printer : System.IO.StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
#if DEBUG
            Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };
#else
            Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };
#endif
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, IEnumerable<T> source) { Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(System.IO.Stream stream) { iStream = stream; }
        private readonly System.IO.Stream iStream;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private bool eof = false;
        public bool IsEndOfStream { get { return eof; } }
        const byte lb = 33, ub = 126, el = 10, cr = 13;
        public byte read()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }
        public string Scan()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            StringBuilder sb = null;
            var enc = System.Text.UTF8Encoding.Default;
            do
            {
                for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;
                if (ptr < len) break;
                ptr = 0;
                if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return ""; }
            } while (true);
            do
            {
                var f = ptr;
                for (; ptr < len; ptr++)
                    if (buf[ptr] < lb || ub < buf[ptr])
                    //if (buf[ptr] == cr || buf[ptr] == el)
                    {
                        string s;
                        if (sb == null) s = enc.GetString(buf, f, ptr - f);
                        else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }
                        ptr++; return s;
                    }
                if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));
                else sb.Append(enc.GetChars(buf, f, len - f));
                ptr = 0;

            }
            while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true; return (sb != null) ? sb.ToString() : "";
        }
        public long Long()
        {
            long ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public int Integer()
        {
            int ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }
        public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }
        public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }
        public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }
        public void Flush() { iStream.Flush(); }
    }
}
#endregion
#region Extension
namespace Solver.Ex
{
    static public partial class EnumerableEx
    {
        static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
        static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    }
}
#endregion

using System;
using System.IO;
using System.Linq;

namespace Timus_CS
{
    static partial class Program
    {
        static void Main(string[] args)
        {

            var n = Program.GetLineProcessed(Convert.ToInt32)[0];
            var x = Program.GetLineProcessed(Convert.ToInt32);
            var y = new int[n - 1];
            for (var i = 0; i < n - 1; i++)
                y[i] = x[i + 1] - x[i];

            var z = new int[n - 2];
            for (var i = 0; i < n - 2; i++)
                z[i] = x[i + 2] - x[i];

            Console.WriteLine(Math.Max(y.Max(), z.Min()));

        }

        public static T[] GetLineProcessed<T>(Func<string,T> action)
        {
            return Console.ReadLine()
                .Split(new char[0], StringSplitOptions.RemoveEmptyEntries)
                .Select(action.Invoke)
                .ToArray();
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace ConsoleApplication25
{
    class Program
    {
        static void Main(string[] args)
        {
            var num = int.Parse(Console.ReadLine());
            var init = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

            int max = int.MaxValue;
            for (int i = 1; i < init.Count - 1; i++)
            {
                var init1 = init.ToList();
                init1.RemoveAt(i);
                var localMax = 0;
                for (int j = 1 ; j < init1.Count; j++)
                {
                    localMax = Math.Max(localMax, init1[j] - init1[j - 1]);
                }

                max = Math.Min(max, localMax);
            }

            Console.WriteLine(max);
            Console.ReadLine();
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication59
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            int[] zac = new int[n];
            string[] str = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                zac[i] = Int32.Parse(str[i]);
            }
            int k = 0;
            int[] max = new int[n-2];
            int min = 0;
            int tmp = 0;
            for (int i = 1; i < n - 1; i++)
            {
                min = 0;
                for (int j = 0; j < n - 1; j++)
                {
                    if (j + 1 != i) { tmp = zac[j + 1] - zac[j]; if (tmp > min) { max[k] = tmp; min = tmp; } }
                    else
                    { tmp = zac[j + 2] - zac[j]; if (tmp > min) { max[k] = tmp; min = tmp; } }
                }
                k++;
            }
            tmp = 1000;
            for (int i = 0; i < n-2; i++)
            {
                if (max[i] < tmp) { min = max[i]; tmp = max[i]; }

            }

            Console.WriteLine(min);
            //Console.ReadLine();
        }
    }
}

using System;

class A496 {
    public static void Main() {
        var n = int.Parse(Console.ReadLine());
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int ans = int.MaxValue;
        for (int i = 0; i < a.Length - 2; ++i)
            ans = Math.Min(ans, a[i + 2] - a[i]);
        for (int i = 0; i < a.Length - 1; ++i)
            ans = Math.Max(ans, a[i + 1] - a[i]);
        Console.WriteLine(ans);
    }
}

using System;

namespace R_A_283
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]), max_d1 = 0, min_d2 = 1050;
            int[] a = new int[n];
            s = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(s[i]);
            }
            for (int i = 0; i < n - 1; i++)
            {
                if (Math.Abs(a[i + 1] - a[i]) > max_d1) max_d1 = Math.Abs(a[i + 1] - a[i]);
            }

            for (int i = 1; i < n - 1; i++)
            {
                if (Math.Abs(a[i - 1] - a[i + 1]) < min_d2) min_d2 = Math.Abs(a[i - 1] - a[i + 1]);
            }
            Console.WriteLine(Math.Max(max_d1,min_d2));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _283_Task_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Int32.Parse(Console.ReadLine());
            int[] zc = new int[N];
            string[] strok = Console.ReadLine().Split(' ');
            for (int i = 0; i < N; i++)
            {
                zc[i] = Int32.Parse(strok[i]);
            }
            int k = 0;
            int[] max = new int[N - 2];
            int min = 0;
            int tmp = 0;
            for (int i = 1; i < N - 1; i++)
            {
                min = 0;
                for (int j = 0; j < N - 1; j++)
                {
                    if (j + 1 != i) { tmp = zc[j + 1] - zc[j]; if (tmp > min) { max[k] = tmp; min = tmp; } }
                    else
                    { tmp = zc[j + 2] - zc[j]; if (tmp > min) { max[k] = tmp; min = tmp; } }
                }
                k++;
            }
            tmp = 1000;
            for (int i = 0; i < N - 2; i++)
            {
                if (max[i] < tmp) { min = max[i]; tmp = max[i]; }

            }

            Console.WriteLine(min);
        }
    }
}

using System;

namespace ConsoleApplication1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] mas = new int[n];
            string[] strmas = (Console.ReadLine()).Split(' ');
            for (int i = 0; i < strmas.Length; i++)
            {
                mas[i] = int.Parse(strmas[i]);
            }
            int d = 0, mind = 0, z = 0;
            int kolver = n - 2;
            int[] masd = new int[kolver];
            while (kolver != 0)
            {
                d = 0;
                z = mas[kolver];
                mas[kolver] = 1001;
                for (int i = 1; i < mas.Length; i++)
                {
                    if (mas[i] != 1001)
                    {
                        if (mas[i - 1] == 1001)
                        {
                            if ((mas[i] - mas[i - 2]) > d)
                            {
                                d = mas[i] - mas[i - 2];
                            }
                        }
                        else
                        {
                            if ((mas[i] - mas[i - 1]) > d)
                            {
                                d = mas[i] - mas[i - 1];
                            }
                        }
                    }
                }
                masd[kolver - 1] = d;
                mas[kolver] = z;
                kolver--;
            }
            mind = masd[0];
            for (int i = 0; i < masd.Length; i++) //ищем миним сложность
            {
                if (masd[i] < mind)
                    mind = masd[i];
            }
            Console.WriteLine(mind.ToString());

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Minimum_Difficulty
{
    class Program
    {
        static IO io = new IO();
        static void Main(string[] args)
        {
            int num_N = io.ReadNum();
            int[] arr_S = io.ReadIntArr();
            int num_R1 = arr_S[1] - arr_S[0];
            int num_R2 = arr_S[2] - arr_S[0];

            int temp1;
            int temp2;
            bool flag = false;

            for (int i = 1; i < num_N - 2; i++)
            {
                temp1 = arr_S[i + 1] - arr_S[i];
                if (temp1 >= num_R2)
                {
                    num_R2 = temp1; flag = true;
                }
                temp2 = arr_S[i + 2] - arr_S[i];
                if (temp1 <= num_R2 && temp2 <= num_R2 && !flag) num_R2 = temp2;
            }

            temp1 = arr_S[num_N - 1] - arr_S[num_N - 2];
            if (temp1 > num_R2) num_R2 = temp1;
            if (num_R1 > num_R2) num_R2 = num_R1;

            Console.WriteLine(num_R2);
            Console.Read();
        }
    }

    class IO
    {
        public int ReadNum()
        {
            return Convert.ToInt32(Console.ReadLine());
        }

        public long ReadLong()
        {
            return Convert.ToInt64(Console.ReadLine());
        }

        public string ReadStr()
        {
            return Console.ReadLine();
        }

        public string[] ReadStrArr()
        {
            return Console.ReadLine().Split(' ');
        }

        public int[] ReadIntArr()
        {
            return Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), s => int.Parse(s));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pr1
{
    class Program
    {
        static void Main()
        {
            int n=Convert.ToInt32(Console.ReadLine());
            var a=  Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);
            int min=99999999,max=0;
            for(int i=2;i<n;i++)
            {
                min=Math.Min(a[i]-a[i-2],min);
            }
            max=min;
            for(int i=1;i<n;i++)
            {
                max=Math.Max(a[i]-a[i-1],max);
            }

            Console.Write(max);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleAA
{
    class Program
    {
        static void Main ( string[] args )
        {
            int n = int.Parse ( Console.ReadLine ( ) );
            int[] mas = new int[n];
            string[] strmas = (Console.ReadLine ( )).Split(' ');
            for (int i = 0; i< strmas.Length; i++)
            {
                mas [i] = int.Parse(strmas[i]);
            }
            int diff = 0, mindiff = 0, z = 0;
            int kolver = n - 2;
            int[] masdiff = new int[kolver]; //массив сложностей для каждой вероятности
            while ( kolver != 0 )
            {
                diff = 0;
                z = mas[kolver];
                mas[kolver] = 1001;
                for ( int i = 1; i < mas.Length ; i++ )
                {
                    if ( mas[i] != 1001 )   //перескакиваем
                    {
                        if ( mas[i - 1] == 1001 )
                        {
                            if ( ( mas[i] - mas[i - 2] ) > diff )
                            {
                                diff = mas[i] - mas[i - 2];
                            }
                        }
                        else
                        {
                            if ( ( mas[i] - mas[i - 1] ) > diff )
                            {
                                diff = mas[i] - mas[i - 1];
                            }
                        }
                    }
                }
                masdiff[kolver-1] = diff;
                mas[kolver] = z;
                kolver--;
            }
            mindiff = masdiff[0];
            for ( int i = 0; i < masdiff.Length; i++ )  //ищем миним сложность
            {
                if ( masdiff[i] < mindiff )
                    mindiff = masdiff[i];
            }
            Console.WriteLine ( mindiff.ToString ( ) );
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharp_Contests
{
    public class Program
    {
        public static void Main() {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(new char[1] { ' ' }).Select(b => int.Parse(b)).ToArray();
            n--;
            int mdiff = int.MaxValue, cdiff = -1;
            for (int i = 1; i < n; i++)
            {
                for (int o = 1; o < a.Length; o++)
                {
                    if (o == i)
                    {
                        cdiff = Math.Max(cdiff, a[o + 1] - a[o - 1]);
                        o++;

                        continue;
                    }
                    cdiff = Math.Max(cdiff, a[o] - a[o - 1]);
                }
                mdiff = Math.Min(mdiff, cdiff);
                cdiff = -1;
            }
            Console.WriteLine(mdiff);
#if DEBUG
            Console.ReadLine();
#endif
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void vvod(ref List<int> a, string[]s)
        {
            for (int i = 0; i < s.Length; i++)
            {
                a.Add(Convert.ToInt32(s[i]));
            }
        }
        static int prov(List<int> a, int n)
        {
            int e = a[n];
            a.RemoveAt(n);
            int max = 0;
            for (int i = 1; i < a.Count; i++)
            {
                if (a[i] - a[i - 1] > max) max = a[i] - a[i - 1];
            }
            a.Insert(n, e);
            return max;
        }

        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Trim().Split(' ');
            List<int> a = new List<int>();
            vvod(ref a, s);
            int min = 4566446;
            int max = 0;
            for (int i = 1; i < n - 1; i++)
            {
                if (prov(a, i) < min) min = prov(a, i);

            }
            Console.WriteLine(min);

        }
    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();
            var sum = Enumerable.Range(0, count - 1).Select(z => x[z + 1] - x[z]).ToArray().Max();
            var rez = Enumerable.Range(0, count - 2).Select(z => x[z + 2] - x[z]).ToArray().Min();
            Console.WriteLine(Math.Max(sum,rez));
        }
    }
}

using System;
using System.Linq;

namespace CSharp
{
    public class _496A
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();

            int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();
            int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();

            Console.WriteLine(Math.Max(max1, min2));
        }
    }
}

using System;

namespace _01
{
    class Program1
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split();

            int r1 = Int32.Parse(s[1]) - Int32.Parse(s[0]);
            int r2= Int32.Parse(s[2]) - Int32.Parse(s[0]);;

            int temp1;
            int temp2;
            bool flag = false;

            for (int i = 1; i < n - 2; i++)
            {
                temp1 = Int32.Parse(s[i + 1]) - Int32.Parse(s[i]);
                if (temp1 >= r2) {
                    r2 = temp1; flag = true;
                }
                temp2 = Int32.Parse(s[i + 2]) - Int32.Parse(s[i]);
                if (temp1 <= r2 && temp2 <= r2 && !flag) r2 = temp2;
            }

            temp1 = Int32.Parse(s[n - 1]) - Int32.Parse(s[n - 2]);
            if (temp1 > r2) r2 = temp1;
            if (r1 > r2) r2 = r1;

            Console.WriteLine(r2);

         }
    }
}

using System;
using System.Linq;

public sealed class TaskA
{
    //==============================//
    private Int16[] mTrack;
    private Int16 mN;
    //==============================//
    public TaskA(Int16 n,Int16[]track)
    {
        mN = n;
        mTrack = track;
    }
    public Int16 Solve()
    {
        Int16 min   = (Int16)(mTrack[2] - mTrack[0]),
              dx;
        for (int i = 1; i < mN-2; i++)
        {
            dx = (Int16)(mTrack[i + 2] - mTrack[i]);
            if (dx < min) min = dx;
        }
        Int16 answ = new Int16();
              answ = min;
        for (int i = 1; i < mN - 1; i++)
        {
            dx = (Int16)(mTrack[i + 1] - mTrack[i]);
            if (dx > answ) answ = dx;
        }
        return answ;
    }
}
public sealed class  Program
{
    static void Main(string[] args)
    {
        Int16 n = Convert.ToInt16(Console.ReadLine());
        Int16[] track = Console.ReadLine().Trim().Split().Select(x => Int16.Parse(x)).ToArray();

        TaskA A = new TaskA(n,track);
        Console.WriteLine(A.Solve());

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace codeforces
{
    class Program
    {

        static int diff(string[] a)
        {
            int max = -1;
            for (int i = 1; i < a.Length; i++)
            {
                if ((Convert.ToInt32(a[i]) - Convert.ToInt32(a[i - 1])) > max) { max = Convert.ToInt32(a[i]) - Convert.ToInt32(a[i - 1]); }
            }

            return max;
        }

        static void Main(string[] args)
        {
            Console.ReadLine();
            var s = Console.ReadLine().Split(' ');
            if (s.Length == 3)
            {
                Console.WriteLine(Convert.ToInt32(s[2]) - Convert.ToInt32(s[0]));
                return;
            }

            int min = 99999999;
            for (int i = 1; i < s.Length - 2; i++)
            {
                List<string> t = new List<string>();
                for (int j = 0; j < s.Length; j++)
                {
                    if (i == j) continue;
                    t.Add(s[j]);
                }
                int d = diff(t.ToArray());
                if (d < min) min = d;
            }

            Console.WriteLine(min);
            return;
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class Program
{
    static char[] SPACE = new[] { ' ' };

    static void Main(string[] args)
    {
#if DEBUG
        using (var input = new StreamReader("input.txt"))
        using (var output = new StreamWriter("output.txt"))
        {
            Console.SetIn(input);
            Console.SetOut(output);

            int n = 0;
            do
            {
                Console.WriteLine();
                Console.WriteLine("Sample {0}", ++n);
                Prog();
            } while (Console.ReadLine() == string.Empty);
        }
#else
            Prog();
#endif
    }

    static int __ptr = 0;
    static string[] __input;
    static int NextInt()
    {
        return int.Parse(__input[__ptr++]);
    }
    static long NextLong()
    {
        return long.Parse(__input[__ptr++]);
    }
    static void ReadTokens(int n)
    {
        __ptr = 0;
        __input = Console.ReadLine().Split(SPACE, n);
    }

    //

    static void Prog()
    {
        ReadTokens(1);
        int n = NextInt();

        int[] nums = new int[n];

        ReadTokens(n);
        for (int i = 0; i < n; i++)
            nums[i] = NextInt();

        int min = int.MaxValue;
        int minIndex = 0;
        for (int i = 0; i < n - 2; i++)
        {
            var left = nums[i];
            var right = nums[i + 2];
            var d = right - left;
            if(d < min)
            {
                min = d;
                minIndex = i + 1;
            }
        }

        var list = new List<int>(nums);
        list.RemoveAt(minIndex);

        var max = int.MinValue;
        for (int i = 0; i < list.Count - 1; i++)
        {
            var left = list[i];
            var right = list[i + 1];
            max = Math.Max(max, right - left);
        }

        Console.WriteLine(max);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CODEFORCES
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            int p = Convert.ToInt32(s[0]);
            int n = Convert.ToInt32(s[1]);
            int c = 0;
            int min = 5000;
            int d = 0;
            for (int i = 1; i < s.Length; i++)
            {
                c = Convert.ToInt32(s[i]);
                p = Convert.ToInt32(s[i - 1]);
                if (c - p > d)
                {
                    d = c - p;
                }

            }
            for (int i = 1; i < s.Length - 1; i++)
            {
                c = Convert.ToInt32(s[i]);
                n = Convert.ToInt32(s[i + 1]);
                p = Convert.ToInt32(s[i - 1]);
                if (n - p < min)
                {
                    min = n - p;
                }

            }
            if (min < d)
                min = d;
            Console.WriteLine(min);

        }
    }
}

// Submitted by Silithus @ Macau
using System;
using System.IO;
using System.Collections.Generic;
using CCF_XOI;

namespace CodeForces
{
	class CF283Div2
	{
		public void Solve(XOI xoi)
		{
			int N, i, j, d, ans;
			int[] A;

			N = xoi.ReadInt();
			A = new int[N];
			for (i = 0; i < N; i++)
				A[i] = xoi.ReadInt();

			ans = A[N - 1] - A[0];

			for (i = 1; i < N - 1; i++)
			{
				for (j = 1, d = 0; j < N; j++)
					d = Math.Max(d, A[j] - A[i == j - 1 ? j - 2 : j - 1]);
				ans = Math.Min(ans, d);
			}

			xoi.o.WriteLine(ans);
		}
	}

	class CodeForcesMain
	{
		static void Main(string[] args)
		{
			(new CF283Div2()).Solve(new XOI());
		}
	}
}

namespace CCF_XOI
{	// version 2014.06.20
	class XOI
	{
		protected StreamReader sr;
		public StreamWriter o;
		protected Queue<string> buf = new Queue<string>();
		public bool EOF = false;

		public XOI()
		{
			this.sr = new StreamReader(Console.OpenStandardInput());
			this.o = new StreamWriter(Console.OpenStandardOutput());
			this.o.AutoFlush = true;
		}

		public XOI(string in_path, string out_path)
		{
			this.sr = new StreamReader(in_path);
			this.o = new StreamWriter(out_path);
			this.o.AutoFlush = true;
		}

		public int ReadInt()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int32.Parse(s);
		}

		public long ReadLong()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int64.Parse(s);
		}

		public double ReadDouble()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture);
		}

		public string ReadString()
		{
			string s = this.GetNext();
			return (s == null ? null : s);
		}

		public string ReadLine()
		{	// I will ignore current buffer and read a new line
			string s = "";
			while (s == "" && !this.EOF)
			{
				s = sr.ReadLine();
				this.EOF = (s == null);
			}
			return (this.EOF ? null : s);
		}

		protected string GetNext()
		{
			if (buf.Count == 0)
			{
				while (buf.Count == 0 && !this.EOF)
				{
					string s = sr.ReadLine();
					if (s == null)
						this.EOF = true;
					else
						foreach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
							buf.Enqueue(ss);
				}
			}

			return (this.EOF ? null : buf.Dequeue());
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace sample
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = Convert.ToInt32(Console.ReadLine());
            int[] holds = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);
            List<int> ds = new List<int>();
            for (int i = 1; i < holds.Length; i++)
            {
                ds.Add(holds[i] - holds[i-1]);
            }
            List<int> dds = new List<int>();
            for (int i = 1; i < ds.Count(); i++)
            {
                dds.Add(ds[i]+ds[i-1]);
            }
            System.Console.WriteLine(ds.Max() > dds.Min() ? ds.Max() : dds.Min());
        }

    }

}

using System;

namespace Calculator
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = Convert.ToInt32(Console.ReadLine());
			int[] a = new int[n];
			String dato = Console.ReadLine();
			String[] datos = dato.Split(' ');
			int m = 0;
			foreach(var variable in datos)
			{
				a[m] = Convert.ToInt32(variable);
				m++;
			}
			int combinaciones = n - 2;
			int dificultad = 0;
			int[] dificultadMaxima = new int[combinaciones];
			for(int i = 0; i < combinaciones; i++)
			{
				for(int j = 0; j < n - 1; j++)
				{
					if(j + 1 == i + 1)
					{
						dificultad = a[j + 2] - a[j];
						j += 1;
					}
					else
					{
						dificultad = a[j + 1] - a[j];
					}

					if (dificultad > dificultadMaxima[i])
						dificultadMaxima[i] = dificultad;
				}
			}
			int minimoTotal = 99999999;
			for(int i = 0; i < combinaciones; i++)
				if (dificultadMaxima[i] < minimoTotal)
					minimoTotal = dificultadMaxima[i];
			Console.WriteLine(minimoTotal);
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class CF_496A
{
    static int Main(string[] args)
    {
        int n = Convert.ToInt32(Console.ReadLine());
        string line = Console.ReadLine();
        string[] snums = line.Split(new char[] { ' ' });
        List<int> nums = new List<int>();
        foreach (var snum in snums)
        {
            nums.Add(Convert.ToInt32(snum));
        }
        int result = new CF_496A().solve(nums.ToArray());
        Console.WriteLine(result);
        return 0;
    }

    public int solve(int[] holds)
    {
        int[] diffs = new int[holds.Length];
        int pn = 0;
        for (int i = 0; i < holds.Length; i++)
        {
            diffs[i] = holds[i] - pn;
            pn = holds[i];
        }

        int min = 1;
        for (int i = 2; i < diffs.Length; i++)
        {
            if (diffs[i] < diffs[min])
                min = i;
            else if (diffs[i] == diffs[min]
                     && i+1 < diffs.Length
                     && min+1 < diffs.Length
                     && (diffs[i] + diffs[i + 1]) < (diffs[min] + diffs[min + 1]))
                min = i;
        }
        if (min == (diffs.Length - 1)) min--;
        diffs[min] += diffs[min + 1];
        int max = diffs[1];
        for (int i = 2; i < diffs.Length; i++)
        {
            if (diffs[i] > max)
                max = diffs[i];
        }
        return max;
    }
}

#if !ONLINE_JUDGE
namespace CodeForces
{
    using NUnit.Framework;

    [TestFixture]
    class Test_CF_496A
    {
        [Test]
        public void Test1()
        {
            int[] nums = { 1, 4, 6 };
            Assert.AreEqual(5, new CF_496A().solve(nums));
        }

        [Test]
        public void Test2()
        {
            int[] nums = { 1, 2, 3, 4, 5 };
            Assert.AreEqual(2, new CF_496A().solve(nums));
        }

        [Test]
        public void Test3()
        {
            int[] nums = { 1, 2, 3, 7, 8 };
            Assert.AreEqual(4, new CF_496A().solve(nums));
        }

        [Test]
        public void Test4()
        {
            int[] nums = { 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 };
            Assert.AreEqual(19, new CF_496A().solve(nums));
        }

        [Test]
        public void Test5()
        {
            int[] nums = {
                178, 186, 196, 209, 217,
                226, 236, 248, 260, 273,
                281, 291, 300, 309, 322,
                331, 343, 357, 366, 377,
                389, 399, 409, 419, 429,
                442, 450, 459, 469, 477,
                491, 501, 512, 524, 534,
                548, 557, 568, 582, 593,
                602, 616, 630, 643, 652,
                660, 670, 679, 693, 707,
                715, 728, 737, 750, 759,
                768, 776, 789, 797, 807,
                815, 827, 837, 849, 863,
                873, 881, 890, 901, 910,
                920, 932};
            Assert.AreEqual(17, new CF_496A().solve(nums));
        }
    }
}
#endif

using System;
using System.IO;
using System.Text;

namespace Minimum_Difficulty
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();

            var nn = new int[n];
            for (int i = 0; i < n; i++)
            {
                nn[i] = Next();
            }

            int min = int.MaxValue;
            for (int i = 2; i < n; i++)
            {
                int d = nn[i] - nn[i - 2];
                if (min > d)
                    min = d;
            }

            int max = int.MinValue;
            for (int i = 1; i < n; i++)
            {
                int d = nn[i] - nn[i - 1];
                if (max < d)
                    max = d;
            }

            writer.WriteLine(Math.Max(min, max));
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace SolvingAlgorithms
{
    class Program
    {
        static void Main(string[] args)
        {

            string input;
            input = Console.ReadLine();
            int climbs = Convert.ToInt32(input);
            input = Console.ReadLine();
            List<String> split = new List<string>(input.Split(' '));
            int minimum = 5000000;
            int remove =1;
            int maximum = 0;
            for (int i = 0; i < split.Count - 2; i++)
            {
                if (minimum > Convert.ToInt32(split[i + 2]) - Convert.ToInt32(split[i]))
                {
                    minimum = Convert.ToInt32(split[i + 2]) - Convert.ToInt32(split[i]);
                    remove = i + 1;
                }
            }
            split.RemoveAt(remove);
            for (int i = 0; i < split.Count - 1; i++)
            {
                if (maximum < Convert.ToInt32(split[i + 1]) - Convert.ToInt32(split[i]))
                {
                    maximum = Convert.ToInt32(split[i + 1]) - Convert.ToInt32(split[i]);
                }
            }
            Console.WriteLine(maximum);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _19._12
{
    class Program
    {
        static int Sunm(List<int> a, int k)
        {
            int q = a[k];
               a.RemoveAt(k);
            int max = 0;
            for (int i = 0; i < a.Count-1; i++)
            {
                if (a[i + 1] - a[i] > max) max = a[i + 1] - a[i];
            }
            a.Insert(k, q);
            return max;
        }
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            List<int> a = new List<int>();
            string s = Console.ReadLine();
            string[] ss = s.Split(' ');
            for (int i = 0; i < n; i++)
            {
                a.Add(Convert.ToInt32(ss[i]));
            }
            int max = 0;
            int min = 10000;
            for (int i = 1; i < a.Count-1; i++)
            {
                max = Sunm(a, i);
                if (max < min) min = max;
            }
            Console.WriteLine(min);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Square
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long minDiff = long.MaxValue;
            for (int i = 1; i < n - 1; i++)
            {
                minDiff = Math.Min(minDiff, GetDifficulty(a, 0, n-1, i));
            }
            Console.WriteLine(minDiff);
            Console.ReadLine();
        }

        static long GetDifficulty(long[] array, long from, long to, long except)
        {
            long diff = array[from + 1] - array[from];
            for (long i = from; i < to; i++)
            {
                if(i+1 == except)
                {
                    long curr = array[i + 2] - array[i];
                    diff = Math.Max(diff, curr);
                    i++;
                }
                else
                {
                    long curr = array[i + 1] - array[i];
                    diff = Math.Max(diff, curr);
                }
            }
            return diff;
        }
    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Crap
{
    class Program
    {
        static void Main(string[] args)
        {

            int n = Convert.ToInt32(Console.ReadLine());
            string[] tmp1 = Console.ReadLine().Split(' ');
            int[] numbers = new int[n];
            int minimum = 2147483647;
            int localMinimum = 0;
            for (int i = 0; i < n; ++i)
            {
                numbers[i] = Convert.ToInt32(tmp1[i]);
            }
            int diff = 0;
            for (int i = 1; i < (n-1); ++i)
            {
                localMinimum = 0;
                for(int j = 1; j < (n); ++j)
                {
                    diff = 0;
                    if (i == j)
                    {
                        if(n == 3)
                        {
                            localMinimum = numbers[j + 1] - numbers[j - 1];
                        }
                        continue;
                    }
                    else if (j == (i + 1))
                    {
                        diff = numbers[j] - numbers[j - 2];
                        if (diff > localMinimum) localMinimum = diff;
                    }
                    else
                    {
                        diff = numbers[j] - numbers[j-1];
                        if (diff > localMinimum) localMinimum = diff;
                    }

                }
                if (localMinimum < minimum) minimum = localMinimum;

            }
            Console.WriteLine(minimum);
        }
    }
}

using System;
using System.Linq;

namespace _496A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int[] diffs = new int[n - 1];
            for (int i = 1; i < n; i++)
                diffs[i - 1] = a[i] - a[i - 1];
            int[] sumDiffs = new int[n - 2];
            for (int i = 1; i < n - 1; i++)
                sumDiffs[i - 1] = diffs[i] + diffs[i - 1];
            int result = Math.Max(diffs.Max(), sumDiffs.Min());
            Console.WriteLine(result);
        }
    }
}

using System;

namespace CodeForces26
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));
			int min = 1000;
			for (int i = 1; i<n-1; i++)
			{
				int max = 0;
				int[] datanew = new int[n - 1];
				for (int j = 0, count = 0; j < n; j++)
					if (j != i) datanew[count++] = data[j];
				for (int j = 0; j < n - 2; j++)
					if (datanew[j + 1] - datanew[j] > max) max = datanew[j + 1] - datanew[j];
				if (max < min) min = max;
			}
			Console.WriteLine(min);
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();

            int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();
            int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();

            Console.WriteLine(Math.Max(max1, min2));
            String test = Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();

            int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();
            int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();

            Console.WriteLine(Math.Max(max1, min2));
            String test = Console.ReadLine();
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cuscontest
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();

            int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();
            int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();

            Console.WriteLine(Math.Max(max1, min2));
        }
    }
}

using System;

namespace ConsoleApplication1
{
    internal class Program
    {
        private static string s;

        private static string[] t;

        private static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            t = Console.ReadLine().Split(' ');

            var a = new int[n];

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

            var min = 1000;

            for (int k = 1; k <= n-2; k++)
            {
                var max = 0;

                for (int i = 1; i < n; i++)
                {
                    if (i == k) continue;

                    var tmp = i == k + 1 ? a[i] - a[i - 2] : a[i] - a[i - 1];

                    if (tmp > max)
                        max = tmp;
                }

                if (min > max)
                    min = max;
            }

            Console.WriteLine(min);
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(File.OpenText("in.txt"));
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(d => int.Parse(d)).ToArray();

            var min = int.MaxValue;
            int ind = 0;
            for (int i = 1; i < a.Length - 1; i++)
            {
                var diff = a[i + 1] - a[i - 1];
                if (diff < min)
                {
                    min = diff;
                    ind = i;
                }
            }

            var max = 0;
            for (int i = 0; i < a.Length - 1; i++)
            {
                int diff;
                if (i == ind - 1)
                {
                    diff = a[i + 2] - a[i];
                }
                else if (i == ind)
                {
                    continue;
                }
                else
                {
                    diff = a[i + 1] - a[i];
                }

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

            Console.WriteLine(max);
        }
    }
}

using System;
using System.Linq;
public class Test
{
    public static void Main()
    {
        // your code goes here
        int n = int.Parse(Console.ReadLine());
        int[] num = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();
        int max = int.MaxValue;
        for(int i = 1 ; i < n - 1 ; i++){
            int localdiff = -1;
            int prev = num[0];
            for(int j = 1 ; j < n ; j++){
                if(j == i)
                   continue;
                localdiff = Math.Max(localdiff,num[j] - prev);
                prev = num[j];
            }
            max = Math.Min(localdiff,max);
        }
        Console.WriteLine(max);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            int n = int.Parse(Console.ReadLine());
            int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            int minim = 10000, minimNormal = 0;
            for (int i = 1; i < n; i++) {
                if (v[i] - v[i - 1] > minimNormal)
                    minimNormal = v[i] - v[i - 1];
            }
            for (int i = 1; i < n - 1; i++) {
                int dif = v[i + 1] - v[i - 1];
                if (dif < minim)
                    minim = dif;
            }
            Console.WriteLine(Math.Max(minim,minimNormal));
            // Console.ReadKey();
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace CodeForces.PRACTICE
{
    // Minimum Difficulty (brute force, implementation, math)
    class _496A
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(ss[i]);
            int max = 0;
            for (int i = 0; i < n - 1; i++)
                max = Math.Max(max, a[i + 1] - a[i]);
            int min = 2000;
            for (int i = 1; i < n - 1; i++)
                min = Math.Min(min, a[i + 1] - a[i - 1]);
            Console.WriteLine(Math.Max(max, min));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CheckCable
{
    class Program
    {

        public static void MimimumDifficulty()
        {
            // 1. Init
            int n = 0; // [3; 100]
            int[] a; // 1 <= a[i] <= 1000

            n = Convert.ToInt32( Console.ReadLine());

            string[] A = Console.ReadLine().Split(' ');
            a = new int[n];
            for (int j = 0; j < n; j++)
            {
                a[j] = Convert.ToInt32(A[j]);
            }

            // 2. Find current difficulty
            int CurrentDifficulty = 0;
            for (int j = 1; j < n; j++) // a[1] --> a[n-1]
            {
                CurrentDifficulty = (CurrentDifficulty < (a[j] - a[j - 1])) ? (a[j] - a[j - 1]) : CurrentDifficulty;
            }

            int CurrentMinimalDifficultyAfterRemovingSingleHold = -1;
            int TempDifficulty = 0;
            for (int j = 2; j < n; j++) // a[2] --> a[n-1]
            {
                TempDifficulty = (CurrentDifficulty < (a[j] - a[j - 2])) ? (a[j] - a[j - 2]) : CurrentDifficulty;
                CurrentMinimalDifficultyAfterRemovingSingleHold = (CurrentMinimalDifficultyAfterRemovingSingleHold < 0) ? TempDifficulty :
                                                                    (CurrentMinimalDifficultyAfterRemovingSingleHold > TempDifficulty) ? TempDifficulty :
                                                                         CurrentMinimalDifficultyAfterRemovingSingleHold;

            }

            // 3. Print Answer
            Console.WriteLine(CurrentMinimalDifficultyAfterRemovingSingleHold);
        }
        static void Main(string[] args)
        {
            MimimumDifficulty();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int numberOfClues = int.Parse(Console.ReadLine());
            int[] arrOfClues = new int[numberOfClues];
            string[] strmas = (Console.ReadLine()).Split(' ');
            for (int i = 0; i < strmas.Length; i++)
            {
                arrOfClues[i] = int.Parse(strmas[i]);
            }
            int differense = 0, mindifferense = 0, z = 0;
            int numberOfProbabilities = numberOfClues - 2;
            int[] masdiff = new int[numberOfProbabilities];
            while (numberOfProbabilities != 0)
            {
                differense = 0;
                z = arrOfClues[numberOfProbabilities];
                arrOfClues[numberOfProbabilities] = 1001;
                for (int i = 1; i < arrOfClues.Length; i++)
                {
                    if (arrOfClues[i] != 1001)
                    {
                        if (arrOfClues[i - 1] == 1001)
                        {
                            if ((arrOfClues[i] - arrOfClues[i - 2]) > differense)
                            {
                                differense = arrOfClues[i] - arrOfClues[i - 2];
                            }
                        }
                        else
                        {
                            if ((arrOfClues[i] - arrOfClues[i - 1]) > differense)
                            {
                                differense = arrOfClues[i] - arrOfClues[i - 1];
                            }
                        }
                    }
                }
                masdiff[numberOfProbabilities - 1] = differense;
                arrOfClues[numberOfProbabilities] = z;
                numberOfProbabilities--;
            }
            mindifferense = masdiff[0];
            for (int i = 0; i < masdiff.Length; i++) //ищем миним сложность
            {
                if (masdiff[i] < mindifferense)
                    mindifferense = masdiff[i];
            }
            Console.WriteLine(mindifferense.ToString());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Task_TD
{

    class Program
    {

        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());

            int[] arr = new int[n];
            string[] lines = Console.ReadLine().Split();

            for (int i = 0; i < n; i++)
            {
                arr[i] = Int32.Parse(lines[i]);
            }

            Console.WriteLine(GetResult(n, arr));

            Console.ReadLine();
        }

        static int GetResult(int n, int[] arr)
        {
            int min = Int32.MaxValue;
            int max = 0;

            for (int i = 1; i < n; ++i)
            {
                if (i > 1)
                {
                    min = Math.Min(min, arr[i] - arr[i - 2]);
                }

                max = Math.Max(max, arr[i] - arr[i - 1]);
            }

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

            return result;
        }

    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp10
{
	class Program
	{
		static void Main(string[] args)
		{
			int size = Convert.ToInt32(Console.ReadLine());
			string a = Console.ReadLine();
			String[] ai = a.Split(' ');
			int item =Sl(1, ai);
			for (int i = 2; i < ai.Length - 1; i++)
			{
				if (Sl(i, ai) < item)
				{
					item = Sl(i, ai);
				}
			}

			Console.Write(item);
		}

		static int Sl(int j, String[] ai)
		{
			int item = 0;
			List<String> list = new List<String>(ai);
			list.RemoveAt(j);
			for (int i = 0; i < list.Count - 1; i++)
			{
				if (Convert.ToInt32(list[i + 1]) - Convert.ToInt32(list[i]) > item)
				{
					item = Convert.ToInt32(list[i + 1]) - Convert.ToInt32(list[i]);
				}
			}
			return item;
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Round_283
{
    class Program
    {
        static void Main(string[] args)
        {
            MinimumDifficulty md = new MinimumDifficulty();
            md.Test();
        }
    }
    class MinimumDifficulty
    {
        int Cost(int[] a)
        {
            int num = 0;
            int cost2 = dif2(a, out num);
            int cost1 = dif1(a, num,cost2);
            return cost1 > cost2 ? cost1 : cost2;
        }
        int dif1(int[] a,int num,int MinCost)
        {
            for(int i=0;i<a.Length;i++)
            {
                if (i == num) continue;
                if (i == num - 1 && i + 2 < a.Length)
                    if (MinCost < a[i + 2] - a[i]) MinCost = a[i + 2] - a[i];
                if (i + 1 < a.Length)
                    if (MinCost < a[i + 1] - a[i]) MinCost = a[i + 1] - a[i];
            }
            return MinCost;
        }
        int dif2(int []a,out int num)
        {
            num = -1;
            int MinCost = int.MaxValue;
            for(int i=0;i<a.Length;i++)
            {
                if(i+2<a.Length)
                {
                    if(a[i+2]-a[i]<MinCost)
                    {
                        num = i + 1;
                        MinCost = a[i + 2] - a[i];
                    }
                }
            }
            return MinCost;
        }
        public void Test()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            string[] s = Console.ReadLine().Split();
            for(int i=0;i<n;i++)
            {
                a[i] = int.Parse(s[i]);
            }
            Console.WriteLine(Cost(a));
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;

namespace prA {

    class Program {
#if ONLINE_JUDGE
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
#else
        private static readonly StreamWriter writer = new StreamWriter("output");
        private static readonly StreamReader reader = new StreamReader("input");
#endif
        static void Main(string[] args) {
            int n = Next();
            int[] a = new int[n];
            a[0] = Next();
            a[1] = Next();
            int mi = 0;
            int ans = int.MaxValue;
            for(int i = 2; i < n; i++) {
                a[i] = Next();
                if(a[i] - a[i - 2] >= ans)
                    continue;
                mi = i - 1;
                ans = a[i] - a[i - 2];
            }
            a[mi] = a[mi - 1];
            for(int i = 1; i < n; i++) {
                ans = Math.Max(a[i] - a[i - 1], ans);
            }
            writer.WriteLine(ans);
            writer.Flush();
#if !ONLINE_JUDGE
            writer.Close();
#endif
        }
        private static int Next() {
            int c;
            int res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(e => int.Parse(e)).ToArray();
            var b = new int[n-2];
            var c = new int[n-1];
            for(int i=0;i<n-2;i++)
            {
                b[i] = a[i + 2] - a[i];
                c[i] = a[i + 1] - a[i];
            }
            c[n - 2] = a[n - 1] - a[n - 2];
            int max = Math.Max(c.Max(),b.Min());

            Console.WriteLine(max);

            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace code_forces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            bool isReadable = int.TryParse(Console.ReadLine(), out n);
            string[] nums = new string[n];
            List<int> num = new List<int>();
            if (isReadable)
            {
                nums = Console.ReadLine().Split(' ');
            }
            foreach(string s  in nums)
            {
                num.Add(Convert.ToInt32(s));
            }

            long min = long.MaxValue;
            long v = 0;
            for (int i = 1; i < nums.Length - 1; i++)
            {
                v = getDiff(num.ToArray(), i);
                if (min > v)
                {
                    min = v;
                }
            }

            Console.WriteLine(min);
            Console.ReadLine();

        }

        public static long getDiff(int[] num, int j)
        {
           long ans = long.MinValue;
           for (int i = 1; i < num.Length; i++)
           {
               if (i == j)
               {
                   ans = Math.Max(ans, num[i + 1] - num[i - 1]);
               }
               else if (i == j + 1)
               {
                  //
               }
               else
               {
                  ans = Math.Max( ans, num[i] - num[i - 1]);
               }
           }
           return ans;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public object Solve()
    {
        int n = ReadInt();
        var a = ReadIntArray();

        int ans = int.MaxValue;
        for (int i = 1; i + 1 < n; i++)
        {
            var b = a.Take(i).Concat(a.Skip(i + 1)).ToArray();
            int max = 0;
            for (int j = 1; j + 1 < n; j++)
                max = Math.Max(max, b[j] - b[j - 1]);
            ans = Math.Min(ans, max);
        }

        return ans;

        return null;
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("game.in");
        //writer = new StreamWriter("game.out");
#endif
        try
        {
            object result = new Solver().Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            Console.WriteLine(ex);
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }

    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }

    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }

    #endregion
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class PairVariable : IComparable<PairVariable>
{
    public int a, b;
    public PairVariable()
    {
        a = b = 0;
    }
    public PairVariable(string s)
    {
        string[] q = s.Split();
        a = int.Parse(q[0]);
        b = int.Parse(q[1]);
    }
    public PairVariable(int a, int b)
    {
        this.a = a;
        this.b = b;
    }
    public int CompareTo(PairVariable pv)
    {
        if (this.a > pv.a)
        {
            return 1;
        }
        else if (this.a < pv.a)
        {
            return -1;
        }
        else
        {
            if (this.b >= pv.b)
            {
                return 1;
            }
            else
            {
                return -1;
            }
        }
    }

}
namespace ConsoleApplication2
{

    class Program
    {

        static int[,] matrix;
        static int[] mark;

        static void DFS(int v)
        {

            mark[v] = 1;
            for (int i = 0; i < matrix.GetLength(0); i++)
            {

                if (matrix[v, i] == 1)
                {

                    if (mark[v] == 0)
                    {
                        DFS(i);
                    }
                }
            }

        }
        static bool IsPrime(int n)
        {
            for (int i = 2; i <= Math.Sqrt(n); i++)
            {
                if (n % i == 0)
                {
                    return false;
                }
            }
            return true;
        }
        static void IsYesNo(bool b)
        {
            if (b)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split();
            int n = int.Parse(ss[0]);
            string[] s = Console.ReadLine().Split();
            int[] m = new int[n];
            for (int i = 0; i < n; i++)
            {
                m[i] = int.Parse(s[i]);
            }
            int[] cnt = new int[n - 1];
            for (int i = 0; i < n - 1; i++)
            {
                cnt[i] = m[i + 1] - m[i];
            }
            /*for (int i = 0; i < cnt.Length; i++)
            {
                Console.Write(cnt[i]+" ");
            }*/
            int ans = int.MaxValue;
            int max = -1;
            for (int i = 0; i < cnt.Length - 1; i++)
            {
                max = cnt[i] + cnt[i + 1];

                for (int e = 0; e < cnt.Length; e++)
                {

                    max = Math.Max(max, cnt[e]);

                }
                ans = Math.Min(max, ans);
            }
            Console.WriteLine(ans);
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;

namespace tren
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] mass = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            List<int> d = new List<int>();
            if (n == 3) { Console.Write(mass[2] - mass[0]); return; }
            int d_max = 0;
            for(int i = 1; i < n - 1; i++)
            {
                List<int> list = mass.ToList();
                list.Remove(mass[i]);
                for(int j = 1; j < list.Count; j++)
                {
                    if (d_max < list[j] - list[j - 1]) d_max = list[j] - list[j - 1];
                }
                d.Add(d_max);
                d_max = 0;
            }
            Console.Write(d.Min());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            int n = Int32.Parse(Console.ReadLine()), max = 0, prom;
            int[] arr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
            List<int> mas = new List<int>(n);
            List<int> mas1 = new List<int>(n), end = new List<int>();
            for (int i = 0; i < n; i++) {
                mas.Add(arr[i]);
            }
            for (int i = 1; i < (n - 1); i++) {
                mas.Remove(arr[i]);
                int[] arr1 = mas.ToArray();
                    for (int j = 1; j < arr1.Length; j++)
                    {
                        prom = arr1[j] - arr1[j - 1];
                        if (prom > max) max = prom;
                    }
                end.Add(max);
                max = 0;
                mas = new List<int>(n);
                for (int k = 0; k < n; k++)
                {
                    mas.Add(arr[k]);
                }
            }
            Console.WriteLine(end.Min());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int[] num = new int[n];
            for (int i = 0; i < n-1; i++)
            {
                for (int j = 0; j < s.Length; j++)
                {
                    if (s[j] == ' ')
                    {
                        num[i] = int.Parse(s.Substring(0, j));
                        s = s.Substring(j + 1);
                        break;
                    }
                }
            }
            num[n - 1] = int.Parse(s);
            int min =1000000;
            for (int i = 0; i < n-2; i++)
            {
                if (num[i + 2] - num[i] < min)
                    min = num[i + 2] - num[i];
            }
            for (int i = 1; i < n; i++)
            {
                if (num[i] - num[i - 1] > min)
                    min = num[i] - num[i - 1];
            }
            Console.WriteLine(min);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ASM
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            int[] line = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray<int>();
            int minDiff = int.MaxValue;

            for(int i=1;i<n-1; i++)
            {
                int[] newTrack = line.Where((source, index) => index != i).ToArray();
                minDiff = Math.Min(minDiff, d(newTrack));
            }

            Console.WriteLine(minDiff);
        }

        static int d(int[] track)
        {
            int max = 0;
            for(int i = 0; i < track.Length-1; i++)
            {
                if (track[i + 1] - track[i] > max) max = track[i + 1] - track[i];
            }
            return max;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;

namespace fun
{
    class Program
    {
        private static TextReader cin = Console.In;
        private static TextWriter cout = Console.Out;
        static void Main(string[] args)
        {
            string s = cin.ReadLine() ;
            int a = int.Parse(s.Split(' ')[0]);
            var t = Array.ConvertAll(cin.ReadLine().Split(' '), int.Parse);
            var ar = new ArrayList(t);
            var br = new ArrayList(t);
            int ans = 100000000;
            int m = -100000000;

            for (int i = 1; i+1 < a; i++)
            {
                ar.RemoveAt(i);
                m = -100000000;
                for(int j=0;j+1<ar.Count;j++)
                    m = Math.Max(m, (int)ar[j+1] - (int)ar[j]);
                ans = Math.Min(ans, m);
                ar =new ArrayList(t);
            }
            cout.WriteLine(ans);

            cin.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            int n = Int32.Parse(Console.ReadLine()), max = 0, prom;
            int[] arr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
            List<int> mas = new List<int>(n);
            List<int> mas1 = new List<int>(n), output = new List<int>();
            for (int i = 0; i < n; i++)
            {
                mas.Add(arr[i]);
            }
            for (int i = 1; i < (n - 1); i++)
            {
                mas.Remove(arr[i]);
                int[] arr1 = mas.ToArray();
                for (int j = 1; j < arr1.Length; j++)
                {
                    prom = arr1[j] - arr1[j - 1];
                    if (prom > max) max = prom;
                }
               output.Add(max);
                max = 0;
                mas = new List<int>(n);
                for (int k = 0; k < n; k++)
                {
                    mas.Add(arr[k]);
                }
            }
            Console.WriteLine(output.Min());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Numerics;

namespace WarmingUpC_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            List<int> heights = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            int[] copyH = new int[n];
            heights.CopyTo(copyH);
            int min = 9999999;
            for (int i = 1; i < n-1; i++)
            {
                heights.RemoveAt(i);
                int aux = MaxDistance(heights, n - 1);
                if (aux < min)
                    min = aux;
                heights = new List<int>(copyH);
            }
            Console.WriteLine(min);
        }
        public static int MaxDistance(List<int> arr, int n)
        {
            int max = -999999;
            for (int i = n-1; i > 0; i--)
            {
                if (arr[i] - arr[i - 1] > max)
                {
                    max = arr[i] - arr[i - 1];
                }
            }
            return max;
        }
    }
}

using System;
using System.Linq;
class Program
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        if (n == 3)
        {
            Console.WriteLine(a[2] - a[0]);
            return;
        }
        var difficulty = 0;
        var minimum = int.MaxValue;
        for (int i = 1; i < a.Length - 1; i++)
        {
            var seq = a.Where((value, index) => index != i).ToArray();
            difficulty = 0;
            for (int j = 1; j < seq.Length; j++)
            {
                difficulty = Math.Max(difficulty, seq[j] - seq[j - 1]);
            }
            minimum = Math.Min(minimum, difficulty);
        }
        Console.WriteLine(minimum);
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
namespace Contest
{
    class CodeForces
    {
        static void Main(string[] args) {
            int n = Convert.ToInt32(Console.ReadLine());
            var arr = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList();
            int min = int.MaxValue;
            for (int i = 1; i < arr.Count - 1; i++)
            {
                var arr1 = new List<int>(arr);
                arr1.RemoveAt(i);
                int max = arr1[1] - arr1[0];
                for (int j = 2; j < arr1.Count; j++)
                    max = Math.Max(arr1[j] - arr1[j-1], max);
                min = Math.Min(max, min);
            }
            Console.Write(min);
        }

    }
}

using System;
using System.Linq;
using System.Collections.Generic;
namespace Contest
{
    class CodeForces
    {
        static void Main(string[] args) {
            int n = Convert.ToInt32(Console.ReadLine());
            var arr = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList();
            int sum = int.MaxValue;
            for (int i = 1; i < arr.Count - 1; i++)
            {
                var arr1 = new List<int>(arr);
                arr1.RemoveAt(i);
                int max = arr1[1] - arr1[0];
                for (int j = 2; j < arr1.Count; j++)
                    max = Math.Max(arr1[j] - arr1[j-1], max);
                if (max < sum)
                    sum = max;
            }
            Console.Write(sum);
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces282
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            string[] s = Console.ReadLine().Split(' ');
            for (int i = 0;i<n;i++)
            {
                a[i] = int.Parse(s[i]);
            }
            int[] p = new int[n-1];
            for (int i = 0;i<n-1;i++)
            {
                p[i] = a[i + 1] - a[i];
            }
            int min = 999;
            for (int i = 0; i < n-2; i++)
            {
                int[] d = new int[n - 2];
                d[i] = p[i] + p[i + 1];
                int k = i+1;
                for (int j = 0; j < i; j++)
                {
                    d[j] = p[j];
                }
                for (int j = i+2; j < n-1;j++)
                {
                    d[k] = p[j];
                    k++;
                }
                    if (d.Max() < min) min = d.Max();
            }
            Console.WriteLine(min);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c)
					return -1;
				return 1;
			}
		}

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

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

		public static string GetString()
		{
			return Console.ReadLine();
		}

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Vertex
		{
			public List<int> edges;

			public int ct;

			public Vertex()
			{
				ct = 0;
				edges = new List<int>();
				for (var i = 0; i < 26; ++i)
					edges.Add(0);
			}
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/
			var n = getInt();
			var l = getList();
			var pp = l[n - 1] - l[0];
			var qq = l[1] - l[0];
			for (var i = 2; i < n; ++i)
			{
				pp = Min(pp, l[i] - l[i - 2]);
				qq = Max(qq, l[i] - l[i - 1]);
			}
			Console.WriteLine(Max(pp, qq));
			/*			input.Close();
			output.Close();*/
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Schema;

namespace Igranje.CF283
{
    class ProblemA
    {
        public static void Main(string[] varg)
        {
            int n = int.Parse(Console.ReadLine());
            string[] tok = Console.ReadLine().Split(new char[] {' '});
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(tok[i]);
            int minIndex = -1;
            int minDelta = Int32.MaxValue;
            for (int i = 0; i < n-2; i++)
            {
                if (a[i + 2] - a[i] < minDelta)
                {
                    minDelta = a[i + 2] - a[i];
                    minIndex = i + 1;
                }
            }

            int minDif = 0;
            for (int i = 0; i < n-1; i++)
            {
                if (a[i + 1] - a[i] > minDif && (i + 1) != minIndex)
                    minDif = a[i + 1] - a[i];
            }

            if (minDelta>minDif) Console.WriteLine(minDelta);
            else Console.WriteLine(minDif);
        }
    }
}

using System;
using System.Linq;

namespace _496A
{
    class Program
    {
        static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            int diff = int.MaxValue, maxDist = int.MinValue;
            var s = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int i=1;i<s.Length-1;i++)
            {
                for (int j=1;j<s.Length;j++)
                {
                    if (j != i) { maxDist = Math.Max(maxDist, s[j] - s[j - 1]); }
                    else { maxDist = Math.Max(maxDist, s[j + 1] - s[j - 1]); j ++; }
                }
                diff = Math.Min(diff, maxDist);
                maxDist = 0;
            }
            Console.WriteLine(diff);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication6
{

    class Program
    {
        static void Main(string[] args)
        {
            int n;
            int max1;
            int max2;
            max1 = 0;
            max2 = 0;
            int count = 0;
            string str1;
            n = Convert.ToInt32(Console.ReadLine());
            int[] trass = new int[n];
            int[] razn1 = new int[n - 1];
            int[] razn2 = new int[n - 2];
            str1 = Console.ReadLine();
            string[] strin1 = str1.Split(' ');
            for (int i = 0; i < n; i++)
            {
                trass[i] = int.Parse(strin1[i]);
            }
            for (int i = 0; i < n - 1; i++)
            {
                razn1[i] = trass[i + 1] - trass[i];

            }
            for (int i = 0; i < n - 2; i++)
            {
                razn2[i] = trass[i + 2] - trass[i];

            }

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

            for (int i = 0; i < n - 2; i++)
            {
                if (razn2[i] > max2)
                {
                    max2 = razn2[i];
                }
            }
             for (int i = 0; i < n - 2; i++) {
                 if (razn1[i] == razn1[i + 1]) { count++;
                      }
                  }
            if ((count==n-2)||(n==3)){Console.WriteLine(max2);}
            else{
                if (max1 > max2) { Console.WriteLine(max2);}
            else { Console.WriteLine(max1); }

            }

            Console.ReadLine();

        }
    }
}

using System;

namespace ConsoleApplication1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Console.WriteLine("Введите количество зацепок и нажмите Enter " +
                              "\nКоличество зацепок в диапазоне от 3 до 100");
            int n = int.Parse(Console.ReadLine());
            int[] mas = new int[n];
            Console.WriteLine(
                    "Введите последовательность высот на которых вистят зацепки." +
                    "\nПоследовательность равна количеству зацепок" +
                    "\nТак же последовательность должна возрастать");

            string[] strmas = (Console.ReadLine()).Split(' ');
            for (int i = 0; i < strmas.Length; i++)
            {
                mas[i] = int.Parse(strmas[i]);
            }
            int d = 0, mind = 0, z = 0;
            int kolver = n - 2;
            int[] masd = new int[kolver];
            while (kolver != 0)
            {
                d = 0;
                z = mas[kolver];
                mas[kolver] = 1001;
                for (int i = 1; i < mas.Length; i++)
                {
                    if (mas[i] != 1001)
                    {
                        if (mas[i - 1] == 1001)
                        {
                            if ((mas[i] - mas[i - 2]) > d)
                            {
                                d = mas[i] - mas[i - 2];
                            }
                        }
                        else
                        {
                            if ((mas[i] - mas[i - 1]) > d)
                            {
                                d = mas[i] - mas[i - 1];
                            }
                        }
                    }
                }
                masd[kolver - 1] = d;
                mas[kolver] = z;
                kolver--;
            }
            mind = masd[0];
            for (int i = 0; i < masd.Length; i++) //ищем миним сложность
            {
                if (masd[i] < mind)
                    mind = masd[i];
            }
            Console.WriteLine(mind.ToString());

        }
    }
}

using System;

namespace ConsoleApplication1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Console.WriteLine("Введите количество зацепок и нажмите Enter " +
                              "\nКоличество зацепок в диапазоне от 3 до 100");
            var n = Convert.ToInt32(Console.ReadLine());
            int[] mas = new int[n];
            int s;
            Console.WriteLine(
                              "Введите последовательность высот на которых вистят зацепки." +
                              "\nПоследовательность равна количеству зацепок" +
                              "\nТак же последовательность должна возрастать");
            string[] strmas = Console.ReadLine().Split(new char[] { ' ', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries);
            for (s = 0; s < (n < strmas.Length ? n : strmas.Length); ++s)
                mas[s] = Convert.ToInt32(strmas[s]);
            Console.WriteLine("Введенный массив:");
            for (s = 0; s< n; ++s)
                Console.Write("{0} ", mas[s]);

            for (int i = 0; i < strmas.Length; i++)
            {
                mas[i] = int.Parse(strmas[i]);
            }
            int d = 0, mind = 0, z = 0;
            int kolver = n - 2;
            int[] masd = new int[kolver];
            while (kolver != 0)
            {
                d = 0;
                z = mas[kolver];
                mas[kolver] = 1001;
                for (int i = 1; i < mas.Length; i++)
                {
                    if (mas[i] != 1001)
                    {
                        if (mas[i - 1] == 1001)
                        {
                            if ((mas[i] - mas[i - 2]) > d)
                            {
                                d = mas[i] - mas[i - 2];
                            }
                        }
                        else
                        {
                            if ((mas[i] - mas[i - 1]) > d)
                            {
                                d = mas[i] - mas[i - 1];
                            }
                        }
                    }
                }
                masd[kolver - 1] = d;
                mas[kolver] = z;
                kolver--;
            }
            mind = masd[0];
            for (int i = 0; i < masd.Length; i++) //ищем миним сложность
            {
                if (masd[i] < mind)
                    mind = masd[i];
            }
            Console.WriteLine(mind.ToString());

        }
    }
}

using System;

namespace _01
{
    class Program1
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split();

            int r1 = Int32.Parse(s[1]) - Int32.Parse(s[0]);
            int r2= Int32.Parse(s[2]) - Int32.Parse(s[0]);;

            int temp1;
            int temp2;

            for (int i = 1; i < n - 2; i++)
            {
                temp1 = Int32.Parse(s[i + 1]) - Int32.Parse(s[i]);
                if (temp1 >= r2) r2 = temp1;
                temp2 = Int32.Parse(s[i + 2]) - Int32.Parse(s[i]);
                if (temp1 <= r2 && temp2 <= r2) r2 = temp2;
            }

            if (r1 > r2) r2 = r1;

            Console.WriteLine(r2);

         }
    }
}

using System;

namespace _01
{
    class Program1
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split();

            int r1 = Int32.Parse(s[1]) - Int32.Parse(s[0]);
            int r2= Int32.Parse(s[2]) - Int32.Parse(s[0]);;

            int temp1;
            int temp2;

            for (int i = 1; i < n - 2; i++)
            {
                temp1 = Int32.Parse(s[i + 1]) - Int32.Parse(s[i]);
                if (temp1 >= r2) r2 = temp1;
                temp2 = Int32.Parse(s[i + 2]) - Int32.Parse(s[i]);
                if (temp1 <= r2 && temp2 <= r2) r2 = temp2;
            }

            temp1 = Int32.Parse(s[n - 1]) - Int32.Parse(s[n - 2]);
            if (temp1 > r2) r2 = temp1;
            if (r1 > r2) r2 = r1;

            Console.WriteLine(r2);

         }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class CF_496A
{
    static int Main(string[] args)
    {
        int n = Convert.ToInt32(Console.ReadLine());
        string line = Console.ReadLine();
        string[] snums = line.Split(new char[] { ' ' });
        List<int> nums = new List<int>();
        foreach (var snum in snums)
        {
            nums.Add(Convert.ToInt32(snum));
        }
        int result = new CF_496A().solve(nums.ToArray());
        Console.WriteLine(result);
        return 0;
    }

    public int solve(int[] holds)
    {
        int[] diffs = new int[holds.Length];
        int pn = 0;
        for (int i = 0; i < holds.Length; i++)
        {
            diffs[i] = holds[i] - pn;
            pn = holds[i];
        }

        int min = 1;
        for (int i = 2; i < diffs.Length; i++)
        {
            if (diffs[i] < diffs[min])
                min = i;
        }
        if (min == (diffs.Length - 1)) min--;
        diffs[min] += diffs[min + 1];
        int max = diffs[1];
        for (int i = 2; i < diffs.Length; i++)
        {
            if (diffs[i] > max)
                max = diffs[i];
        }
        return max;
    }
}

#if !ONLINE_JUDGE
namespace CodeForces
{
    using NUnit.Framework;

    [TestFixture]
    class Test_CF_496A
    {
        [Test]
        public void Test1()
        {
            int[] nums = { 1, 4, 6 };
            Assert.AreEqual(5, new CF_496A().solve(nums));
        }

        [Test]
        public void Test2()
        {
            int[] nums = { 1, 2, 3, 4, 5 };
            Assert.AreEqual(2, new CF_496A().solve(nums));
        }

        [Test]
        public void Test3()
        {
            int[] nums = { 1, 2, 3, 7, 8 };
            Assert.AreEqual(4, new CF_496A().solve(nums));
        }

        [Test]
        public void Test4()
        {
            int[] nums = { 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 };
            Assert.AreEqual(19, new CF_496A().solve(nums));
        }
    }
}
#endif

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class CF_496A
{
    static int Main(string[] args)
    {
        int n = Convert.ToInt32(Console.ReadLine());
        string line = Console.ReadLine();
        string[] snums = line.Split(new char[] { ' ' });
        List<int> nums = new List<int>();
        foreach (var snum in snums)
        {
            nums.Add(Convert.ToInt32(snum));
        }
        int result = new CF_496A().solve(nums.ToArray());
        Console.WriteLine(result);
        return 0;
    }

    public int solve(int[] holds)
    {
        int[] diffs = new int[holds.Length];
        int pn = 0;
        for (int i = 0; i < holds.Length; i++)
        {
            diffs[i] = holds[i] - pn;
            pn = holds[i];
        }

        int min = 1;
        for (int i = 2; i < diffs.Length; i++)
        {
            if (diffs[i] < diffs[min])
                min = i;
        }
        if (min == (diffs.Length - 1)) min--;
        diffs[min] += diffs[min + 1];
        int max = diffs[1];
        for (int i = 2; i < diffs.Length - 1; i++)
        {
            if (diffs[i] > max)
                max = diffs[i];
        }
        return max;
    }
}

#if !ONLINE_JUDGE
namespace CodeForces
{
    using NUnit.Framework;

    [TestFixture]
    class Test_CF_496A
    {
        [Test]
        public void Test1()
        {
            int[] nums = { 1, 4, 6 };
            Assert.AreEqual(5, new CF_496A().solve(nums));
        }

        [Test]
        public void Test2()
        {
            int[] nums = { 1, 2, 3, 4, 5 };
            Assert.AreEqual(2, new CF_496A().solve(nums));
        }

        [Test]
        public void Test3()
        {
            int[] nums = { 1, 2, 3, 7, 8 };
            Assert.AreEqual(4, new CF_496A().solve(nums));
        }
    }
}
#endif

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Square
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long min = a[1]-a[0];
            for (int i = 1; i < n-1; i++)
            {
                long d = a[i + 1] - a[i - 1];
                min = Math.Max(min, d);
            }
            Console.WriteLine(min);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Square
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long min = long.MaxValue;
            for (int i = 1; i < n-1; i++)
            {
                long d = a[i + 1] - a[i - 1];
                min = Math.Max(min, d);
            }
            Console.WriteLine(min);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Square
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long min = long.MaxValue;
            for (int i = 1; i < n-1; i++)
            {
                long d = a[i + 1] - a[i - 1];
                min = Math.Min(min, d);
            }
            Console.WriteLine(min);
            Console.ReadLine();
        }
    }
}

using System;

namespace CodeForces26
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));
			int min = 1000;
			for (int i = 0; i < n - 2; i++)
				if (Math.Abs(data[i + 2] - data[i]) < min) min = Math.Abs(data[i + 2] - data[i]);
			Console.WriteLine(min);
		}
	}
}

using System;

namespace CodeForces26
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));
			int min = 1000;
			int max = 0;
			for (int i = 1; i<n-1; i++)
			{
				int[] datanew = new int[n - 1];
				for (int j = 0, count = 0; j < n; j++)
					if (j != i) datanew[count++] = data[j];
				for (int j = 0; j < n - 2; j++)
					if (datanew[j + 1] - datanew[j] > max) max = datanew[j + 1] - datanew[j];
				if (max < min) min = max;
			}
			Console.WriteLine(min);
		}
	}
}

using System;

namespace CodeForces26
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));
			int min = 0;
			if (data.Length == 3) min = data[2] - data[0];
			else
			{
				for (int i = 0; i < n - 1; i++)
					if (data[i + 1] - data[i] > min) min = data[i + 1] - data[i];
			}
			Console.WriteLine(min);
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            int n = int.Parse(Console.ReadLine());
            int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            int minim = 10000, minimNormal = 10000;
            for (int i = 1; i < n; i++) {
                if (v[i] - v[i - 1] < minimNormal)
                    minimNormal = v[i] - v[i - 1];
            }
            for (int i = 1; i < n - 1; i++) {
                int dif = v[i + 1] - v[i - 1];
                if (dif < minim)
                    minim = dif;
            }
            Console.WriteLine(Math.Max(minim,minimNormal));
            // Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            int n = int.Parse(Console.ReadLine());
            int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            int minim = 10000;
            for (int i = 1; i < n - 1; i++) {
                int dif = v[i + 1] - v[i - 1];
                if (dif < minim)
                    minim = dif;
            }
            Console.WriteLine(minim);
           // Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace code_forces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            bool isReadable = int.TryParse(Console.ReadLine(), out n);
            string[] nums = new string[n];
            List<int> num = new List<int>();
            if (isReadable)
            {
                nums = Console.ReadLine().Split(' ');
            }
            foreach(string s  in nums)
            {
                num.Add(Convert.ToInt32(s));
            }

            long min = long.MaxValue;
            long v = 0;
            for (int i = 1; i < nums.Length - 1; i++)
            {
                v = getDiff(num.ToArray(), i);
                if (min > v)
                {
                    min = v;
                }
            }

            Console.WriteLine(min);

        }

        public static long getDiff(int[] num, int j)
        {
           long ans = 0;
           for (int i = 1; i < num.Length; i++)
           {
               if (i == j)
               {
                   ans += num[i + 1] - num[i - 1];
               }
               else
               {
                    ans += num[i]-num[i-1];
               }
           }
           return ans;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            int n = Int32.Parse(Console.ReadLine()), max = 0, prom;
            int[] arr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
            List<int> mas = new List<int>(n);
            List<int> mas1 = new List<int>(n), end = new List<int>();
            for (int i = 0; i < n; i++) {
                mas.Add(arr[i]);
                mas1.Add(arr[i]);
            }
            for (int i = 1; i < (n - 1); i++) {
                mas.Remove(arr[i]);
                int[] arr1 = mas.ToArray();
                for (int j = 1; j < arr1.Length; j++) {
                    prom = arr1[j] - arr1[j - 1];
                    if (prom > max) max = prom;
                }
                end.Add(max);
                max = 0;
                mas = mas1;
            }
            Console.WriteLine(end.Min());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;

namespace fun
{
    class Program
    {
        private static TextReader cin = Console.In;
        private static TextWriter cout = Console.Out;
        static void Main(string[] args)
        {
            string s = cin.ReadLine() ;
            int a = int.Parse(s.Split(' ')[0]);
            var t = Array.ConvertAll(cin.ReadLine().Split(' '), int.Parse);
            var ar = new ArrayList(t);
            var br = new ArrayList(t);
            int ans = 100000000;
            int m = -100000000;

            for (int i = 1; i+1 < a; i++)
            {
                ar.RemoveAt(i);
                for(int j=0;j+1<ar.Count;j++)
                    m = Math.Max(m, (int)ar[j+1] - (int)ar[j]);
                ans = Math.Min(ans, m);
                ar =new ArrayList(t);
            }
            cout.WriteLine(ans);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CF496A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (n == 3)
            {
                Console.WriteLine(a[2] - a[0]);
                return;
            }
            var difficulty = 0;
            var minimum = int.MaxValue;
            for (int i = 1; i < a.Length - 1; i++)
            {
                var seq = a.Where((value, index) => index != i).ToArray();
                difficulty = 0;
                for (int j = 1; j < seq.Length; j++)
                {
                    difficulty = Math.Max(difficulty, seq[j] - seq[j - 1]);
                }
                minimum = Math.Min(minimum, difficulty);
            }
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
namespace Contest
{
    class CodeForces
    {
        static void Main(string[] args) {
            int n = Convert.ToInt32(Console.ReadLine());
            var arr = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList();
            int sum = int.MaxValue;
            for (int i = 1; i < arr.Count - 1; i++)
            {
                var arr1 = new List<int>(arr);
                int acum = 0;
                arr1.RemoveAt(i);
                for (int j = 1; j < arr1.Count; j++)
                    acum += arr1[j] - arr1[j - 1];
                if (acum < sum)
                    sum = acum;

            }
            Console.Write(sum);
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces282
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            string[] s = Console.ReadLine().Split(' ');
            for (int i = 0;i<n;i++)
            {
                a[i] = int.Parse(s[i]);
            }
            int[] p = new int[n-1];
            for (int i = 0;i<n-1;i++)
            {
                p[i] = a[i + 1] - a[i];
            }
            int[] d = new int[n - 2];
            for (int i = 0;i<n-2;i++)
            {
                d[i] = p[i + 1] + p[i];
            }
            Console.WriteLine(d.Max());
        }
    }
}

using System;
using System.Linq;

namespace _496A
{
    class Program
    {
        static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            int diff = int.MaxValue, maxDist = int.MinValue;
            var s = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int i=1;i<s.Length-1;i++)
            {
                for (int j=1;j<s.Length;j++)
                {
                    if (j != i) { maxDist = Math.Max(maxDist, s[j] - s[j - 1]); }
                    else { maxDist = Math.Max(maxDist, s[j + 1] - s[j - 1]); j ++; }
                }
                diff = Math.Min(diff, maxDist);
            }
            Console.WriteLine(diff);
        }
    }
}

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Collections;

    namespace SolvingAlgorithms
    {
        class Program
        {
            static void Main(string[] args)
            {

                string input;
                input = Console.ReadLine();
                int climbs = Convert.ToInt32(input);
                input = Console.ReadLine();
                string[] split = input.Split(' ');
                int minimum = 5000000;
                for (int i = 0; i < split.Length-2; i++)
                {
                    if (minimum > Convert.ToInt32(split[i + 2]) - Convert.ToInt32(split[i]))
                    {
                        minimum = Convert.ToInt32(split[i + 2]) - Convert.ToInt32(split[i]);
                    }
                }
                Console.WriteLine(minimum);

            }

        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _19._12
{
    class Program
    {
        static int Sunm(List<int> a, int k)
        {
            a.RemoveAt(k);
            int max = 0;
            for (int i = 0; i < a.Count-1; i++)
            {
                if (a[i + 1] - a[i] > max) max = a[i + 1] - a[i];
            }
            return max;
        }
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            List<int> a = new List<int>();
            string s = Console.ReadLine();
            string[] ss = s.Split(' ');
            for (int i = 0; i < n; i++)
            {
                a.Add(Convert.ToInt32(ss[i]));
            }
            int max = 0;
            int min = 10000;
            for (int i = 1; i < a.Count-1; i++)
            {
                max = Sunm(a, i);
                if (max < min) min = max;
            }
            Console.WriteLine(min);
        }
    }
}