#include<stdio.h>
#include<stdlib.h>
struct node
{
    int data;
    struct node *next;
};
struct node* insertend(struct node *head,int value)
{
    struct node *newnode = (struct node*)malloc(sizeof(struct node));
    newnode->data = value;
    newnode->next = NULL;
    if(head == NULL)
   return newnode;
   
   struct node *temp = head;
   while (temp->next  != NULL)
   {
       temp = temp->next;
       temp->next = newnode;
       return head;
   }
  struct node* dele(struct node *head,int value,int *found)
  {
      if(head == NULL)
      return NULL;
      if(head->data == value)
      {
          struct node *temp = head;
          head = head->next;
          free(temp);
          *found = 1;
          return head;
      }
      struct node *curr = head;
      while(curr->next != NULL)
      {
          if(curr->next->data == value)
          {
              struct node *temp = curr->next;
              curr->next = temp->next;
              free(temp);
              *found = 1;
              return head;
              
          }
          curr = curr->next;
      }
      return head;
      }
      void display(struct node *head)
      {
          if(head == NULL)
          {
              printf("list is empty");
              return;
          }
          struct node *temp = head;
          while(temp != NULL)
          {
              printf("%d",temp->data);
              temp = temp->next;
          }
          
        }
        
        
        int main()
        {
            int n,value,todelete;
            struct node *head = NULL;
            scanf("%d",&n);
            if(n <= 0)
            {
              printf("list is empty");
              return;
            }
            for(int i=0;i<n;i++)
            {
                scanf("%d",&value);
                head = insertend(head,value);
                
            }
            scanf("%d",&todelete);
            int found = 0;
            head = dele(head,todelete,&found);
            if(!found)
            {
                printf("Not Found");
            }
            else
            {
                display(head);
            }
            return 0;
        }