uses crt;
var a:array[1..100]of integer;
k,n,i,tam,x,t:integer;
begin
clrscr;
write('nhap so ban hoc sinh:'); readln(n);
for i:=1 to n do
begin
write('ma so thu ',i,' la:'); readln(a[i]);
end;
{----------------------sap-day-tang-dan--------------------}
for i:=1 to n-1 do
for k:=i+1 to n do
if a[i]>a[k] then begin
t:=a[i];
a[i]:=a[k];
a[k]:=t;
end;
{-----------------------xu-ly-chen--------------------------}
write('nhap ma so k:'); readln(k);
i:=1;
while(k>a[i]) and (i<=n) do
i:=i+1;
for x:=n+1 downto i do
a[x]:=a[x-1];
a[i]:=k;
writeln('ket qua la:');
for i:=1 to n+1 do write(a[i],' ');
readln;
end.