#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node *next;
    
}Node;

Node *head=NULL,*tail,*prev;
void create(int num){
    Node *newNode=(Node*)malloc(sizeof(Node));
    newNode->data=num;
    newNode->next=NULL;
    
    if(head==NULL){
        head= newNode;
        tail= newNode;
    }
    else{
        tail->next= newNode;
        tail= newNode;
    }
}

void delete(int element){
    Node *temp ,*prev;
      int count=0;
     temp=head;
     
     
     if(head->data=element){
         temp=head;
         head=head->next;
         free(temp);
     }
     while(temp!=NULL && temp->data!=element){
         prev=temp;
         temp=temp->next;
         if(temp->data==element){
            count=1; 
         }
     }
       if(count != 1){
           printf("Not Found");
       }
     
      
        prev->next=temp->next;
        
        if(temp==NULL){
            printf("List is empty");
        }
         free(temp);
}

display(){
    temp=head;
    while(temp!=NULL){
        printf("%d",temp->data);
        temp=temp->next;
    }
}

int main(){
    int n,val,e;
    scanf("%d",&n);
    for(int i=0 ; i<n ;i++){
        scanf("%d",&val);
        create(val);
    }
    scanf("%d",&e);
    delete(e);
   
    display();
    return 0;
}