#include<stdio.h>
#include<stdlib.h>
typedef struct TreeNode{
    int data;
    struct TreeNode *left;
    struct TreeNode *right;
}node;
node *root=NULL;
node* create(int val){
    node *newnode=(node*)malloc(sizeof(node));
    newnode->data=val;
    newnode->left=newnode->right=NULL;
    return newnode;
}
node* insert(node* root,int val){
    if(root==NULL){
        return create(val);
    }
    if(val<root->data){
        root->left=insert(root->left,val);
    }
    else{
        root->right=insert(root->right,val); 
    }
    return root;
}
node* small(node* root){
    if(root==NULL)return NULL;
    if(root->left==NULL)
    return root;
    return small(root->left);
}
int main(){
    int n;
    if(scanf("%d",&n)<0){
        printf("Invalid input");
        return 0;
    }
    int x;
    for(int i=0;i<n;i++){
    if(!scanf("%d",&x));
    printf("Invalid input");
    return 0;
  }
   root=insert(root,x);
}
node* s=small(root);
if(s!=NULL){
printf("%d ",s->data);
return 0;
}