#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_at_pos(int element){
    Node *temp ,*prev;
      int count=0;
     temp=head;
     
     if(head==NULL){
         printf("List is empty");
         return 0;
     }
     
     if(head->data==element){
         temp=head;
         head=head->next;
         free(temp);
     }
     while(temp!=NULL && temp->data!=element){
         prev=temp;
         temp=temp->next;
     }
       if(temp==NULL){
           printf("Not Found");
       }
       
     
      
        prev->next=temp->next;
        
        if(temp==tail){
            prev=tail;
        }
        
        
         free(temp);
}

void display(){
    Node *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_at_pos(e);
    display();
    return 0;
}