program ask(input, output);

const max=100000;

var n, i, j, k, count, c:integer;
    a: array [1..max] of integer;
    fl, flag: boolean;

begin
readln(n);
for i:=1 to n do read(a[i]);

count:=0;
flag:=false;
j:=0;
k:=0;
while not flag do
begin
   while a[n-j]>0 do j:=j+1;
   while a[k+1]<0 do k:=k+1;
   i:=k+2;
   while i<=n-j do
   begin
      if (a[i-1]>0) and (a[i]<0) then
      begin
         c:=a[i-1];
         a[i-1]:=a[i];
         a[i]:=c;
         count:=count+1;
      end;
   i:=i+1;
   end;

   fl:=true;
   i:=k+2;
   while fl and (i<=n-j) do
   begin
      if (a[i-1]>0) and (a[i]<0) then
      begin
         c:=a[i-1];
         a[i-1]:=a[i];
         a[i]:=c;
         count:=count+1;
         fl:=false;
      end;
      i:=i+1;
   end;
   if fl=true then flag:=true;
end;

writeln(count);
writeln(a[1]);
writeln(a[n]);
end.