program ask(input, output);

const max=100000;

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

begin
readln(n);

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

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

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