#include <stdio.h>
#include <stdlib.h>


typedef struct TreeNode{
    int data;
    struct TreeNode *left;
    struct TreeNode *right;
}Node;

Node *root = NULL;

Node *createBST(int num){
    Node *newnode=(Node*)malloc(sizeof(Node));
    
    newnode->data=num;
    newnode->left=newnode->right=NULL;
    return newnode;
}


Node *insertBST(Node *root, int num){
    if(root==NULL){
        return createBST(num);
    }
    if(root->data>num){
        root->left=insertBST(root->left, num);
    }else{
        root->right=insertBST(root->right, num);
    }
    return root;
}

void sortedorder(Node *root){
    if(root!=NULL){
        sortedorder(root->left );
        printf("%d ", root->data);
        sortedorder(root->right);
    }
}

void minimum(){
    while(root!=NULL){
        root=root->left;
        if(root->left==NULL){
            printf("%d", root->data);
            break;
        }
        
    }
}

int main(){
    int size, num;
    scanf("%d", &size);
    
    if(size<0){
        printf("Invalid input");
        return 0;
    }
    
    for(int i=0; i<size; i++){
        scanf("%d", &num);
        root = insertBST(root, num);
    }
    sminimun();
    return 0;
}