Uses crt;
var i,n,max: longint;
a: array[1..100] of longint;
begin clrscr;
readln(n);
fot i:=1 to n do read(a[i]); readln;
for i:=1 to n do if(a[i]<0) then write(a[i],' ');
max:=a[1];
for i:=1 to n do if(max<a[i]) then max:=a[i];
writeln(max);
readln;
end.