/*1 - 재귀 + 재귀메모이제이션 + 구조체설명약간
2 - 정렬 (버블, 선택, 삽입)
3 - 구조체 + 구조체정렬
4 - 퀵정렬 + 이분 탐색
- 탐색 (이진탐색, or DFS,BFS)*/
/*#include <stdio.h>
typedef struct
{
char name[100];
int year;
int month;
int day;
} schedule;
int main()
{
int n,i,j;
schedule s[101]={},k;
scanf("%d",&n);
for(i=1; i<=n; i++)
{
scanf("%s %d %d %d",s[i].name,&s[i].year,&s[i].month,&s[i].day);
}
for(i=1; i<n; i++)
{
for(j=1; j<n-i+1; j++)
{
if(s[j].year>s[j+1].year)
{
k=s[j];
s[j]=s[j+1];
s[j+1]=k;
}
else if(s[j].year==s[j+1].year)
{
if(s[j].month>s[j+1].month)
{
k=s[j];
s[j]=s[j+1];
s[j+1]=k;
}
else if(s[j].month==s[j+1].month)
{
if(s[j].day>s[j+1].day)
{
k=s[j];
s[j]=s[j+1];
s[j+1]=k;
}
else if(s[j].day==s[j+1].day)
{
/*if(strlen(s[j].name)<=strlen(s[j+1].name))*/
/*{*/
/* for(int i=1; i<=strlen(s[j].name); i++)
{
if(s[j].name[i]>s[j+1].name[i])
{
k=s[j];
s[j]=s[j+1];
s[j+1]=k;
}
}*/
/*}*/
/*else if(strlen(s[j].name)>strlen(s[j+1].name))
{
for(int i=1; i<=strlen(s[j+1].name)+1; i++)
{
if(s[j].name[i]>s[j+1].name[i])
{
k=s[j];
s[j]=s[j+1];
s[j+1]=k;
}
}
}*//*
}
}
}
}
}
for(i=1; i<=n; i++)
{
printf("%s\n",s[i].name);
}
}
}*/
#include <stdio.h>
int partition(int a[],int begin, int end)
{
int n;
int pivot,L,R,k=0;
pivot=(begin+end)/2;
L=begin;
R=end;
while(L<R)
{
while(a[L]<a[pivot]&&L<R) L++;
while(a[R]>=a[pivot]&&L<R) R--;
if(L<R)
{
k=a[L];
a[L]=a[R];
a[R]=k;
if(L==pivot) pivot=R;
}
}
k=a[R];
a[R]=a[pivot];
a[pivot]=k;
return R;
}
int quicksort(int a[],int begin,int end)
{
int L,R,n;
L=begin;
R=end;
int part;
if(L<R)
{
part = partition(a,L,R);
quicksort(a,part+1,R);
quicksort(a,L,part-1);
}
}
int main()
{
int n,i,arr[101]={};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
quicksort(arr,0,n-1);
for(int i=0;i<n;i++)
{
printf("%d ",arr[i]);
}
}



