#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int data;
    struct node*next,*prev;
}a;
a*head=NULL,*tail;
void create(int num){
    a*newNode=(a*)malloc(sizeof(a));
    newNode->data=num;
    newNode->next=NULL;
    newNode->prev=NULL;
    if(head==NULL){
        head=newNode;
        tail=newNode;
    }
    else{
        tail->next=newNode;
        tail=newNode;
    }
}
void deletion(int value){
    a*first=head;
    a*second=head->next;
    if(value==head->next){
        head->next=head;
    }
    else{
        while(second->next!=NULL){
            int cnt=0;
            if(second->data==value){
                first->next=second->next;
                free(second);
            }
        }
        first=first->next;
        second=second->next;
    }
}
void traverse(){
    a*itr;
    for(itr=head;itr!=NULL;itr=itr->next){
        printf("%d ",itr->data);
    }
}
int main(){
    int size,value,num,pos,itr;
    scanf("%d",&size);
    if(value==NULL){
        printf("Node not found");
    }
    for(itr=0;itr<size;itr++){
        scanf("%d",&num);
        create(num);
    }
    deletion(value);
    return 0;
}