#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
void quicksort(int a[],int left,int right)
{
int i,j,key;
if(left>=right)
return;
key=a[left];
i=left;j=right;
while(i<j)
{
while(i<j&&key<=a[j])
{
j--;
}
a[i]=a[j];
while(i<j&&key>=a[i])
{
i++;
}
a[j]=a[i];
}
a[i]=key;
quicksort(a,left,i-1);
quicksort(a,i+1,right);
}
int main()
{
int n,i,j,a[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
quicksort(a,0,n-1);
for(i=0;i<n;i++)
printf("%d ",a[i]);
return 0;
}
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
void quicksort(int a[],int left,int right)
{
int i,j,key;
if(left>=right)
return;
key=a[left];
i=left;j=right;
while(i<j)
{
while(i<j&&key<=a[j])
{
j--;
}
a[i]=a[j];
while(i<j&&key>=a[i])
{
i++;
}
a[j]=a[i];
}
a[i]=key;
quicksort(a,left,i-1);
quicksort(a,i+1,right);
}
int main()
{
int n,i,j,a[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
quicksort(a,0,n-1);
for(i=0;i<n;i++)
printf("%d ",a[i]);
return 0;
}