uses crt;
var a,b,c,d:array[1..100]of integer;
n,i,dem,dem1,dem2:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{------------------------------xu-ly------------------------------}
dem:=0;
dem1:=0;
dem2:=0;
for i:=1 to n do
if a[i]<0 then
begin
inc(dem);
b[dem]:=a[i];
end
else if a[i]=0 then
begin
inc(dem1);
c[dem1]:=a[i];
end
else begin
inc(dem2);
d[dem2]:=a[i];
end;
for i:=1 to dem do
write(b[i]:4);
for i:=1 to dem1 do
write(c[i]:4);
for i:=1 to dem2 do
write(d[i]:4);
readln;
end.