// editor2
#include<stdio.h>
#include<stdlib.h>
typedef struct node{
int data;
struct node *left;
struct node *right;
}node;
node *root= NULL;
/////////create///////////
void create(int val){
    if(val ==0){
        return ;
    }
    node *newnode=(node*)malloc(sizeof(node));
    newnode->data = val;
    newnode->left = NULL;
    newnode->right= NULL;
    return newnode;
}
////build//////
void buildtree(int arr[], int n,int i){
    if(root == NULL)
    return NULL;
    node *root = create(arr[i]);
    root->left=buildtree(arr,size,2*i+1);
    root->right=buildtree(arr,size,2*i+2);
    return root;
}
int main(){
    int size;
    scanf("%d",&size);
    node *root =NULL;
    for (int i=0;i<size;i++){
        int h;
        scanf("%d"&h);
        root =insert(root,h);
     void insert(node root,int h);
        if(root == NULL)
        return create(h);
        if(h<root->data){
            root->left=insert(root->left);
        }
        else
            root->right=insert(root->right);
            return root;
    }
    void inorder(int node *root){
        if(root == NULL)
        return;
        inorder(root->left);
        printf("%d",root->data);
        inorder(root->right);
    }
}