#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=NULL;
    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++){
        scanf("%d",&x);
        if(!x||x<0){
            printf("Invalid input");
            return 0;
        }
        root=insert(root,x);
    }
    printf("%d",small(root));
    return 0;
}