#include<iostream.h>
void main()
{
int a[1000],j,i,n=0,aux=0;
cout<<"n: "; cin>>n;
for(i=1;i<=n;i++)
{
cout<<"a["<<i<<"]=";
cin>>a[i];
}
for(i=1;i<=n;i++)
cout<<a[i]<<" ";
cout<<endl;
for(i=1;i<=n;i++)
{
for(j=i+1;j<=n;j++)
{
if(a[i]>a[j])
{
aux=a[i];
a[i]=a[j];
a[j]=aux;
}
}
}
for(i=1;i<=n;i++)
cout<<a[i]<<" ";
}