// editor4
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
typedef struct node{
    int data;
    struct node*next;
}node;
node*head=NULL,*tail=NULL;
node* createnode(int data){
    node* newnode=(node*)malloc(sizeof(node))
    if(!newnode){
        printf("Memory allocation fails");
        exit(1);
    }
    newnode->data=data;
    newnode->next=NULL;
    return newnode;
}
void deleteatindex(node*head,int v){
    if(head==v){
        free(head);
        exit(1);
    }
    node*temp=head;
    else if(temp->next->next!=v){
        printf("Value not found");
    }
    else if(head==NULL{
            printf("List is empty");
        }
    else if(isalpha(head)){
        printf("Invalid input");
    }
}
void printlist(node*node){
    while(node){
        printf("%d",node->data);
        node=node->next;
    }
}
int main(){
    int n,val,s;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&s);
        node*newnode=createnode(s);
        if(head==NULL){
            head=tail=newnode;
        }
        tail->next=newnode;
        tail=newnode;
    }
    scanf("%d",&val);
    deleteatindex(head,val);
    printlist(head);
    return 0;
}