program usp;
var n,i,x,y,pomocni:integer;
    a,uspon:array [1..1000] of integer;
begin
readln(n);
for i:= 1 to n do readln(a[i]);
x:=1;
if a[1]<a[2] then pomocni:=pomocni+(a[2]-a[1]);
for i:= 1 to n do begin
if a[i]<a[i+1] then begin
uspon[x]:=uspon[x]+(a[i+1]-a[i]);
end;
if a[i]>a[i+1] then x:=x+1;
if a[i]=a[i+1] then x:=x+1;
end;
uspon[1]:=y;
for i:= 1 to n do begin
if uspon[i]>y then y:=uspon[i];
end;
if y>pomocni then writeln(y) else writeln(pomocni);
end.