#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
struct TreeNode {
    int data;
    struct TreeNode *left,*right;
};
struct TreeNode* createNode(int data) {
    struct TreeNode* newnode=(struct TreeNode*)malloc(sizeof(struct TreeNode));
    newNode->data = data;
    newNode->left=newNode->right=NULL;
    return newNode;
}
struct TreeNode* insert(struct TreeNode* root, int data){
    if (root == NULL)
    return createNode(data);
    
    if (data < root->data)
    root->left = insert(root->left,data);
    else
    root->right = insert(root->right,data);
    return root;
    
}
int findMin(struct TreeNode* root){
    if(root==NULL) return -1;
    while(root->left !=NULL)
    root=root->left;
    return root->data;
}
int main(){
    int n,value;
    struct TreeNode* root=NULL;
    if (scanf("%d", &n) != 1|| n<1){
        printf("Invalid Input");
        return 0;
        for (int i=0;i<n;i++){
            if(scanf("%d", &value) != 1){
                printf("Invalid Input");
                return 0;
                }
                root=insert(root,value);
            
        }
        printf("%d", findMin(root));
        return 0;
        
    }