
#include <stdio.h>
??
#define max 500000
??
int L[250002];
int R[250002];

??
??
??
int merge(int S[], int n, int l, int m, int r)?? {
????int i, j, k;
????int n1 = m - l;
????int n2 = r - m;
??????
????for (i = 0; i < n1; i++)
????????L[i] = A[l+i];
????for (i = 0; i < n2; i++)
????????R[i] = A[m+i];
??????
????L[n1] = R[n2] = 500000000
??????
????i = j = 0;
????for ( k = l; k < r; k++)?? {
????????if ( L[i] <= R[j])?? {
????????????A[k] = L[i]; 
i++;
}
????????else{
????????????A[k] = R[j];
j++;
}
????}
}
??
void mergeSort(int S[], int n, int l, int r)?? {
????
????if (l + 1 < r)?? {
????????int m = (l+r) / 2;
????????mergeSort(S,n, l,m);
????????mergeSort(S, n,m,r);
????????merge(S,n, l,m,r);
????}
}
??
int main(void)?? {
????int S[max], n, i;
????c = 0;
??????
????scanf("%d", &n);
????for (i = 0; i < n; i++) 
????????scanf("%d", &S[i]);
??????
????mergeSort(S, n, 0, n);
??
????for (i = 0; i < n; i++)?? {
????????if(i==0){
??????printf("%d", S[i]);}
else if (i){
????????????printf(" ");
????????printf("%d", S[i]);}
????}
????
????printf("\n%d\n", c);
??????
????return 0;
}
??
??