#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
void sort(int *a,int *b,int low,int mid,int high){
int i,j,k;
for(i=low;i<=high;i++)
b[i]=a[i];
for(i=low,j=mid+1,k=i;i<=mid&&j<=high;k++){
if(b[i]<=b[j])
a[k]=b[i++];
else
a[k]=b[j++];
}
while(i<=mid)
a[k++]=b[i++];
while(j<=high)
a[k++]=b[j++];
}
void Mergesort(int *a,int *b,int low,int high){
if(low<high){
int mid=(low+high)/2;
Mergesort(a, b, low, mid);
Mergesort(a, b, mid+1, high);
sort(a, b, low, mid, high);
}
}
int main(){
int a[10]={2,4,9,10,29,-4,0,11,100,-28},b[10]={0};
Mergesort(a, b, 0, 9);
for(int i=0;i<10;i++){
cout<<a[i]<<" ";
}
}