#include <iostream>
using namespace std;

class TreeNode {
public:
    int value;
    TreeNode* left;
    TreeNode* right;

    TreeNode(int val) {
        value = val;
        left = right = nullptr;
    }
};

TreeNode* insert(TreeNode* root, int value) {
    // Base case: if the tree is empty, create a new node
    if (root == nullptr) {
        return new TreeNode(value);
    }

    // Recursively find the correct position to insert the new value
    if (value < root->value) {
        root->left = insert(root->left, value);  // Insert in the left subtree
    } else {
        root->right = insert(root->right, value);  // Insert in the right subtree
    }

    return root;  // Return the root of the tree
}

bool searchBST(TreeNode* root, int target) {
    // Base case: if the root is null or we found the target
    if (root == nullptr) {
        return false;
    }
    if (root->value == target) {
        return true;
    }

    // Recursively search the left or right subtree based on the target
    if (target < root->value) {
        return searchBST(root->left, target);
    } else {
        return searchBST(root->right, target);
    }
}

int main() {
    TreeNode* root = nullptr;
    int n, value, target;

    cin >> n;  // number of nodes
    for (int i = 0; i < n; i++) {
        cin >> value;  // node values
        root = insert(root, value);  // Insert the value into the tree
    }

    cin >> target;  // target value to search
    cout << (searchBST(root, target) ? "true" : "false") << endl;  // Search for the target

    return 0;
}
