Заранее сорян, если накосячил c точками - запятыми и тд. (c++ one love)
program lolkekchebyrek;
var a[n], b, c, i : integer;
begin
read(n);
for i := 1 to n do begin
read(a[i]);
end;
for i := 1 to n do begin
if a[i] < 0 then begin
write(a[i], " ");
end;
for i := 1 to n do begin
if a[i] > 0 then begin
write(a[i], " ");
end;
end.