#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int data;
    struct node *next;
}s2;
s2 *head=NULL,tail=NULL;
s2 *first=head,*second=head->next;
void create(int num){
    s2 *New=(s2*)malloc(1*sizeof(s2));
    New->data=num;
    New->next=NULL;
    if(head==NULL){
        head=New;
        tail=New;
    }else{
        tail=tail->next;
        tail=New;
    }
}
void delete(ele){
    while(second !=NULL){
        if(first->data == ele){
            first->next=second->next;
        }
        first=first->next;
        second=second->next;
    }
    
}
void display(){
    s2 *i;
    for(i=head;i!=NULL;i=i->next){
        printf("%d ",i->data);
    }
}
int main(){
    int size,num,ele;
    scanf("%d",&size);
    for(int itr=0;itr<size;itr++){
        scanf("%d ",&num);
        create(num);
    }
    scanf("%d",ele);
    delete(ele);
    
}