#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
struct Node{
    int data;
    struct Node* prev;
    struct Node* next;
}Node;

struct Node* createNode(Node **head,int* data){
    struct Node* newNode=(struct Node*)malloc(sizeof(Node));
    newNode->data=data;
    newNode->prev=NULL;
    newNode->next=NULL;
    return newNode;
}

void append(struct Node** head, int data) {
    struct Node* newNode = createNode(data);
    if (*head == NULL) {
        *head = newNode;
        return;
    }
   struct Node* temp = *head;
    while (temp->next != NULL) {
        temp = temp->next;
    }
    temp->next = newNode;
    newNode->prev = temp;
}

int search(struct Node* head,int target){
    struct Node* current=head;
    while(current !=NULL){
        if(current->data == target){
            return 1;
        }
    }
    return 0;
}
int main(){
     int n;
    if (scanf("%d", &n) != 1 || n < 1 || n > 1000) {
        printf("Invalid input");
        return 0;
    }
    struct Node *head=NULL;
    char buffer[50];
    for(int i=0;i<n;i++){
        if(scanf("%s",buffer) != 1){
            printf("Invalid input");
            return 0;
        }
        append(&head,value);
    }
     scanf("%d", &target);
    search(head, target);
    
    struct Node* temp;
    while (head != NULL) {
        temp = head;
        head = head->next;
        free(temp);
    }

    return 0;

}