#include<bits/stdc++.h>
using namespace std;
#define MAX_NODE 10000005

typedef long long ll;
ll INF = 1e18;


struct node{
  node* parent;
  node* left;
  node* right;
  double random;
  int size;
  ll value;
};
typedef node* Node;

node _nodev[ MAX_NODE ];
int _nodec=0;

int Size(Node p){
  return (p?p->size:0);
}

double Random(Node p){
  return (p?p->random:-1e20);
}

void Update(Node p){
  if(!p)return;
  p->size=Size(p->left)+Size(p->right)+1;
  if(p->left)p->left->parent=p;
  if(p->right)p->right->parent=p;
}

Node Makenode(ll x,Node par=NULL){
  Node res= &_nodev[ _nodec++ ];
  res->parent=par;
  res->left=NULL;
  res->right=NULL;
  res->random=rand();
  res->size=1;
  res->value=x;
  return res;
}

void Rightrotate(Node p){
  assert( p->left );  
  Node top=p->parent;
  Node fox=p->left;
  if(top){
    if(top->left==p)top->left=fox;
    else top->right=fox;
  }
  fox->parent=top;
  p->left=fox->right;
  fox->right=p;
  Update(p);
  Update(fox);
}

void Leftrotate(Node p){
  assert( p->right );  
  Node top=p->parent;
  Node fox=p->right;
  if(top){
    if(top->left==p)top->left=fox;
    else top->right=fox;
  }
  fox->parent=top;
  p->right=fox->left;
  fox->left=p;
  Update(p);
  Update(fox);
}

Node Findkth(Node p,int k){
  assert(p);
  assert( 0<=k && k< Size(p) );
  int f=Size(p->left);
  if(k==f)return p;
  if(k<f)return Findkth(p->left,k);
  return Findkth(p->right, k-f-1);
}

Node Findroot(Node p){
  if(!p->parent)return p;
  Update(p);
  return Findroot(p->parent);
}

void Rotateup( Node p ){
  for(Node i=p; i ; i=i->parent ){
    Update(i);
    if(Random(i) < Random(i->left)) Rightrotate(i);
    if(Random(i) < Random(i->right)) Leftrotate(i);
  }
}

void Insertlast(Node &p,ll value){
  if(!p){
    p=Makenode(value);
    return;
  }
  assert( !p->parent );
  Node i;
  for( i = p ; i->right ; i=i->right );
  i->right=Makenode(value);
  Rotateup(i);
  p=Findroot(i);
}

/*
void Insertkth(Node &p,int k,ll value){
  if(!p){
    p=Makenode(value);
    return;
  }
  if(Size(p)>=k){
    Insertlast(p,value);
    return;
  }
  assert( p->parent == NULL );

  Node target = Findkth(p,k);
  
  Node nv=Makenode(value);
  
  if( !target->left ){
    target->left=nv;
  }else{
    target=Findkth(p,k-1);
    target->right=nv;
  }
  Rotateup(target);
  p=Findroot(p);
}

void Deletekth(Node &p,int k){
  assert( p->parent == NULL );
  
  Node target=Findkth(p,k);
  while( target->left || target->right ){
    if( !target->left ){
      Leftrotate(target);
      break;
    }
    if( !target->right ){
      Rightrotate(target);
      break;
    }
    double lv=Random(target->left);
    double rv=Random(target->right);
    if( lv > rv )Rightrotate(target);
    else Leftrotate(target);
  }
  if(!target->parent){
    p=NULL;
    return;
  }
  Node top=target->parent;
  if(top->left==target)top->left=NULL;
  else top->right=NULL;
  p=Findroot(top);
}
*/
void printf(Node p,int depth=0){

  for(int i=0; i<depth * 2; i++) cout << " ";

  if(!p) {cout << "(nil)" << endl; return;}

  cout << "(" << p->value << "[" << p->random / 10000.0 << "]" << endl;

  printf(p->left, depth + 1);
  printf(p->right, depth + 1);

  for(int i=0; i<depth * 2; i++) cout << " ";

  cout << ")" << endl;
  
  /*  
  if(!p)return;
  printf( p->left ,depth+1);

  for(int i=0;i<depth;i++)cout<<" ";
  cout<< (p->value) <<' '<<p->size<<' '<< endl;
  
  printf( p->right ,depth+1);
  */
}

int main(){
  Node root=NULL;
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    Insertlast(root,x);
  }
  
  for(int i=n-1;i>=0;i--){
    if(i<n-1)cout<<' ';
    Node p=Findkth(root,i);
    cout<< p->value ;
  }
  cout<<endl;
  
  /*
  Node root=NULL;
  for(int i=0;i<10;i++){
    int x;
    cin>>x;
    Insertlast(root,x);
  }
  printf(root);

  cout<<endl;
  for(int i=0;i<10;i++){
    Node n = Findkth(root,i);
    cout<< n->value <<' ';
  }
  cout<<endl;
  */
  return 0;
}

Measured memory_bytes: 3104