#include <stdio.h>
#include <stdlib.h>

// Define the TreeNode structure
struct TreeNode {
    int data;
    struct TreeNode* left;
    struct TreeNode* right;
};

// Function to create a new node
struct TreeNode* newNode(int data) {
    struct TreeNode* node = (struct TreeNode*)malloc(sizeof(struct TreeNode));
    node->data = data;
    node->left = node->right = NULL;
    return node;
}

// Function to insert a new node into the BST
struct TreeNode* insert(struct TreeNode* root, int data) {
    if (root == NULL) {
        return newNode(data);
    }
    
    if (data < root->data) {
        root->left = insert(root->left, data); // Insert in left subtree
    }else if(data>root->data){
        root->right = insert(root->right, data); // Insert in right subtree
    }
    else{
        printf();
    }
    
    return root;
}

// Function to search for a value in the BST
int search(struct TreeNode* root, int target) {
    if (root == NULL) {
        return 0; // Target not found
    }
    
    if (root->data == target) {
        return 1; // Target found
    }
    
    if (target < root->data) {
        return search(root->left, target); // Search left
    } else {
        return search(root->right, target); // Search right
    }
}
int searchIterative(struct TreeNode*root,int target){
    while(root!=NULL){
        if(root_.data==target)return 1;
        if(target<root->data) root=root->left;
        else root=root->right;
    }
    return 0;
}
void freetree(struct TreeNode*root){
    if(root==NULL) return;
    freetree(root->left);
    freetree(root->right);
    free(root);
}

void inorder(struct TreeNode*root){
    if(root==NULL)return;
    inorder(root->left);
    printf("%d",root->right);
    inorder(root->right);
}
void preorder(struct TreeNode*root){
    if(root==NULL)return;
    printf("%d",root->right);
    preorder(root->left);
    preorder(root->right);
}
void postorder(struct TreeNode)

int main() {
    int n, target;
    
    // Read the number of nodes to insert into the BST
    if(scanf("%d", &n)!=1);
    
    // If n <= 0, print "Invalid input" and exit
    if (n <= 0) {
        printf("Invalid input\n");
        return 0;
    }
    
    struct TreeNode* root = NULL;
    
    // Insert the n integers into the BST
    for (int i = 0; i < n; i++) {
        int value;
        if(scanf("%d",value)!=1){
            printf("Invalid input\n");
            freetree(root);return 0;
        }
    }
    
    // Read the target integer to search for
    if(scanf("%d"),&target)!=1){
        printf("Invalid input\n");
        freetree(root);return 0;
    }
    
    // Search for the target in the BST and print the result
    if (searchIterative(root, target)) {
        printf("Found\n");
    } else {
        printf("Not Found\n");
    }
    freetree(root);
    return 0;
}