#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
struct TreeNode{
    int data;
    struct TreeNode *left, *right;
};
struct TreeNode* createNode(int value){
    struct TreeNode* newNode = (struct TreeNode*)malloc(sizeof(struct TreeNode));
    newNode->data = value;
    newNode->left = newNode->right = NULL;
    return newNode;
}
struct TreeNode* insert(struct TreeNode* root, int value){
    if(root == NULL)
        return createNode(value);
    if(value < root->data)
        root->left = insert(room->left, value);
    else
        root->right = insert(root->right, value);
    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;
    if(scanf("%d", &N) != 1 || N < 1 || N > 1000){
        printf("Invalid input");
        return 0;
    }
    struct TreeNode* root = NULL;
    int value;
    for(int i = 0; i < N; i++){
        if(scanf("%d", &value) != 1){
            printf("Invalid input");
            return 0;
        }
        root = insert(root, value);
    }
    int minValue = findMin(root);
    printf("%d", minValue);
    return 0;
}