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