def m(L,R):
 global c;c+=len(L)+len(R)
 T=[];j=0
 for l in L:
  while j<len(R)and R[j]<l:T+=[R[j]];j+=1
  T+=[l]
 while j<len(R):T+=[R[j]];j+=1
 return T
def d(A):s=len(A)//2;return m(d(A[:s]),d(A[s:])) if len(A)>1 else A
c=0
input()
print(*d(list(map(int,input().split()))))
print(c) def m(L,R):
 global c;c+=len(L)+len(R)
 T=[];j=0
 for l in L:
  while j<len(R)and R[j]<l:T+=[R[j]];j+=1
  T+=[l]
 while j<len(R):T+=[R[j]];j+=1
 return T m global c c+=len(L)+len(R) c len(L)+len(R) len(L) len L len(R) len R T=[] T [] j=0 j 0 for l in L:
  while j<len(R)and R[j]<l:T+=[R[j]];j+=1
  T+=[l]
  l L while j<len(R)and R[j]<l:T+=[R[j]];j+=1
   j<len(R)and R[j]<l j<len(R) j len(R) len R R[j]<l R[j] R j l T+=[l] T [l] l while j<len(R):T+=[R[j]];j+=1
  j<len(R) j len(R) len R return T T L L R R def d(A):s=len(A)//2;return m(d(A[:s]),d(A[s:])) if len(A)>1 else A d A A c=0 c 0 input() input print(*d(list(map(int,input().split())))) print *d(list(map(int,input().split()))) d(list(map(int,input().split()))) d list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split print(c) print c def d(A):s=len(A)//2;return m(d(A[:s]),d(A[s:])) if len(A)>1 else A def d(A):s=len(A)//2;return m(d(A[:s]),d(A[s:])) if len(A)>1 else A d c=0 0 c def m(L,R):
 global c;c+=len(L)+len(R)
 T=[];j=0
 for l in L:
  while j<len(R)and R[j]<l:T+=[R[j]];j+=1
  T+=[l]
 while j<len(R):T+=[R[j]];j+=1
 return T def m(L,R):
 global c;c+=len(L)+len(R)
 T=[];j=0
 for l in L:
  while j<len(R)and R[j]<l:T+=[R[j]];j+=1
  T+=[l]
 while j<len(R):T+=[R[j]];j+=1
 return T m
def m(L,R):
 global c;c+=len(L)+len(R)
 T=[];j=0
 for l in L:
  while j<len(R)and R[j]<l:T+=[R[j]];j+=1
  T+=[l]
 while j<len(R):T+=[R[j]];j+=1
 return T
def d(A):s=len(A)//2;return m(d(A[:s]),d(A[s:])) if len(A)>1 else A
c=0
input()
print(*d(list(map(int,input().split()))))
print(c)
