#include<stdio.h>

void merge(int [],int,int,int);
void mergesort(int,int,int);

main(){
  int n,s[1000000];
  int left = 0;
  int i;
  
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&s[i]);
  }
  int mid = (left+n)/2;
  
  merge(s,left,mid,n);    
  
  return 0;
}

void merge(int A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;
  
  n1 = mid - left;
  n2 = right - mid;
  
  int l[n1],r[n2];
  
  for(i = 0; i < n1-1; i++){
    l[i] = A[left + i];
  }
  for(i = 0; i < n2-1;){
    r[i] = A[mid + i];
  }
  i = 0;
  j = 0;
  
  for(k = left; k = right - 1; k++){
    if(l[i] <= r[j]){
      i += 1;
    }
    else{
      A[k] = r[j];
      j += 1;
    }
  }
}

void mergesort(A,left,right){
  int mid;
  if(left + 1 < right){
    mid = (left + right)/2;
    mergesort(A,left,mid);
    mergesort(A,mid,right);
    merge(A,left,mid,right);
  }
}