#include <stdio.h>
#include <stdlib.h>void merge(int r[],int first,int last,int mid){ int number_temp[10]={0}; int i=first,j=mid+1,k; for(k=0;k<=last-first;k++) { if (i==mid+1) { number_temp[k]=r[j++]; continue; } if (j==last+1) { number_temp[k]=r[i++]; continue; } if (r[i]<r[j]) number_temp[k]=r[i++]; else number_temp[k]=r[j++]; } for (i=first,j=0;i<=last;i++,j++) r[i] = number_temp[j];}void merge_sort(int r[],int first,int last){ int mid=0; if(first<last) { mid=(first+last)/2; merge_sort(r,first,mid); merge_sort(r,mid+1,last); merge(r,first,last,mid); }}int main(){ int r[10]={0},n,i; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&r[i]); merge_sort(r,0,n-1); for(i=0;i<n;i++) printf("%d ",r[i]); system("pause"); return 0;}