#include <stdio.h>
#include <string.h>
#define LEN 20
int a[LEN];
int n;
void merge(int left, int mid, int right)
{
int n1 = mid - left + 1;
int n2 = right - mid;
int l[n1], r[n2];
int i, j, k;
for (i = 0; i < n1; i++)
l[i] = a[left+i];
for (j = 0; j < n2; j++)
r[j] = a[mid+1+j];
i = j = 0;
for (k = left; i < n1 && j < n2; ++k) {
if (l[i] < r[j]) {
a[k] = l[i];
++i;
} else {
a[k] = r[j];
++j;
}
}
if (i < n1)
for (; i < n1; i++) {
a[k] = l[i];
++k;
}
if (j < n2)
for (; j < n2; ++j) {
a[k] = r[j];
++k;
}
}
void sort(int left, int right)
{
int mid;
if (left < right) {
mid = (left + right) / 2;
sort(left, mid);
sort(mid + 1, right);
merge(left, mid, right);
}
}
int main(void)
{
memset(a, -1, sizeof(a));
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
sort(0, n-1);
for (int i = 0; i < n; i++)
printf("%d ", a[i]);
printf("\n");
return 0;
}
10-10