uses crt;
var
a:array[1..100] of integer;
i,j,n,t,l,k,dem1,dem2: integer;
procedure init;
begin
clrscr;
write(' n = '); readln(n);
for i:=1 to n do
begin
write('a[i]= '); readln(a[i]);
end;
end;
procedure processing;
begin
for j:=n downto 1 do
for i:=1 to j-1 do
if a[i]>a[i+1] then
begin
t:=a[i];
a[i]:=a[i+1];
a[i+1]:=t;
end;
end;
procedure check;
begin;
for i:=1 to n do
if a[i]=0 then
for k:=1 to n do
write(a[k],' ') else
begin
for i:=1 to n do
begin
if a[i]<0 then dem1:=dem1+1;
if a[i]>0 then dem2:=dem2+1;
end;
for k:=1 to dem1 do
write(a[k],' ');
write('0 ');
for l:=dem2 to n do
write(a[l],' ');
end;
end;
procedure print;
begin
for i:=1 to n do
writeln(a[i]);
end;
BEGIN
init;
processing;
check;
readln;
END.
end;