import java.util.Scanner;

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

	int n;

	do
	    {
		n = In.nextInt();
	    }while(n <= 2 && n >= 200000);

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	    {
		do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9));
	    }

	int minv = a[0];
	int maxv = a[1] - a[0];

	for(int j = 1; j <= n-1; j++)
	    {
		maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv);
		minv = minv < a[j] ? minv : a[j];
	    }
	System.out.println(maxv);
    }
} import java.util.Scanner; Scanner java.util public class Main
{
    public static void main(String[] args)
    {
	Scanner In = new Scanner(System.in);

	int n;

	do
	    {
		n = In.nextInt();
	    }while(n <= 2 && n >= 200000);

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	    {
		do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9));
	    }

	int minv = a[0];
	int maxv = a[1] - a[0];

	for(int j = 1; j <= n-1; j++)
	    {
		maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv);
		minv = minv < a[j] ? minv : a[j];
	    }
	System.out.println(maxv);
    }
} Main public static void main(String[] args)
    {
	Scanner In = new Scanner(System.in);

	int n;

	do
	    {
		n = In.nextInt();
	    }while(n <= 2 && n >= 200000);

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	    {
		do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9));
	    }

	int minv = a[0];
	int maxv = a[1] - a[0];

	for(int j = 1; j <= n-1; j++)
	    {
		maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv);
		minv = minv < a[j] ? minv : a[j];
	    }
	System.out.println(maxv);
    } main {
	Scanner In = new Scanner(System.in);

	int n;

	do
	    {
		n = In.nextInt();
	    }while(n <= 2 && n >= 200000);

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	    {
		do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9));
	    }

	int minv = a[0];
	int maxv = a[1] - a[0];

	for(int j = 1; j <= n-1; j++)
	    {
		maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv);
		minv = minv < a[j] ? minv : a[j];
	    }
	System.out.println(maxv);
    } Scanner In = new Scanner(System.in); In new Scanner(System.in) int n; n do
	    {
		n = In.nextInt();
	    }while(n <= 2 && n >= 200000); n <= 2 && n >= 200000 n <= 2 n 2 n >= 200000 n 200000 {
		n = In.nextInt();
	    } n = In.nextInt() n In.nextInt() In.nextInt In int []a = new int[n]; a new int[n] n for(int i = 0; i < n; i++)
	    {
		do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9));
	    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
		do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9));
	    } {
		do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9));
	    } do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9)); 1 >= a[i] && a[i] >= Math.pow(10,9) 1 >= a[i] 1 a[i] a i a[i] >= Math.pow(10,9) a[i] a i Math.pow(10,9) Math.pow Math 10 9 {
			a[i] = In.nextInt();
		    } a[i] = In.nextInt() a[i] a i In.nextInt() In.nextInt In int minv = a[0]; minv a[0] a 0 int maxv = a[1] - a[0]; maxv a[1] - a[0] a[1] a 1 a[0] a 0 for(int j = 1; j <= n-1; j++)
	    {
		maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv);
		minv = minv < a[j] ? minv : a[j];
	    } int j = 1; int j = 1; j 1 j <= n-1 j n-1 n 1 j++ j++ j {
		maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv);
		minv = minv < a[j] ? minv : a[j];
	    } {
		maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv);
		minv = minv < a[j] ? minv : a[j];
	    } maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv) maxv maxv > (a[j] - minv) ? maxv : (a[j] - minv) maxv > (a[j] - minv) maxv (a[j] - minv) a[j] a j minv maxv (a[j] - minv) a[j] a j minv minv = minv < a[j] ? minv : a[j] minv minv < a[j] ? minv : a[j] minv < a[j] minv a[j] a j minv a[j] a j System.out.println(maxv) System.out.println System.out System System.out maxv String[] args args public class Main
{
    public static void main(String[] args)
    {
	Scanner In = new Scanner(System.in);

	int n;

	do
	    {
		n = In.nextInt();
	    }while(n <= 2 && n >= 200000);

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	    {
		do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9));
	    }

	int minv = a[0];
	int maxv = a[1] - a[0];

	for(int j = 1; j <= n-1; j++)
	    {
		maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv);
		minv = minv < a[j] ? minv : a[j];
	    }
	System.out.println(maxv);
    }
} public class Main
{
    public static void main(String[] args)
    {
	Scanner In = new Scanner(System.in);

	int n;

	do
	    {
		n = In.nextInt();
	    }while(n <= 2 && n >= 200000);

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	    {
		do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9));
	    }

	int minv = a[0];
	int maxv = a[1] - a[0];

	for(int j = 1; j <= n-1; j++)
	    {
		maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv);
		minv = minv < a[j] ? minv : a[j];
	    }
	System.out.println(maxv);
    }
} Main
import java.util.Scanner;

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

	int n;

	do
	    {
		n = In.nextInt();
	    }while(n <= 2 && n >= 200000);

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	    {
		do	    
		    {
			a[i] = In.nextInt();
		    }while(1 >= a[i] && a[i] >= Math.pow(10,9));
	    }

	int minv = a[0];
	int maxv = a[1] - a[0];

	for(int j = 1; j <= n-1; j++)
	    {
		maxv = maxv > (a[j] - minv) ? maxv : (a[j] - minv);
		minv = minv < a[j] ? minv : a[j];
	    }
	System.out.println(maxv);
    }
}