#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node *right;
    struct node *left;
}Node;

Node *root=NULL;
Node *create(int num){
    Node *newNode =(Node*)malloc(1 * sizeof(Node));
    newNode->data=num;
    newNode->left=NULL;
    newNode->right=NULL;
    return newNode;
}

void inOrder(Node *root){
    if(root!=NULL){
        inOrder(root->left);
        printf("%d",root->data);
        inOrder(root->right);
        
    }
}

Node *insert(Node *root,int num){
    if(root == NULL){
        return create(num);
    }else if(num<root->data){
        root->left=insert(root->left,num);
    }else if(num > root->data){
        root->right=insert(root->right,num);
    }
    return root;
}



int main(){
    int n,i;
    char num[202];
    scanf("%d",&n);
    if(n<0){
        
    }
    getchar();
    for(i=0;i<n;i++){
        scanf("%c",&num);
        if(num == ' '){
            continue;
        }root =insert(root,num);
    }
    inOrder(root);
    
    return 0;
}