// editor2
#include<stdio.h>
#include<stdlib.h>

typedef struct Node{
    int data;
    struct Node*next;
    struct Node*prev;
    
}Node;
Node* head = NULL;

Node*createNode(int val){
    Node* n=(Node *)malloc(sizeof(Node));
    n->data=val;
    n->prev=NULL;
    n->next=NULL;
    
    return n;
}
void insertAtEnd(int val){
    Node*newNode=createNode(val);
    if(head==NULL){
        head=newNode;
        return;
    }
    Node* temp=head;
    while(temp->next!=NULL){
        temp=temp->next;
    }
    temp->next=newNode;
    newNode->prev=temp;
}
 void removeDuplicates(){
     Node* current =head;
     while(current != NULL){
         Node* runner = current->next;
         while(runner != NULL){
             if(runner->data == current->data){
                 Node* duplicate = runner;
                 runner=runner->next;
                 if(duplicate->prev !=NULL)
                 duplicate->prev->next = duplicate->next;
                 if(duplicate->next !=NULL)
                 duplicate->next->prev=duplicate->prev;
                 free(duplicate);
             }else{
                 runner=runner->next;
             }
         }
         current = current->next;
     }
     
 }
 void display(){
     Node*temp=head;
     while(temp!=NULL){
         printf("%d ",temp->data);
         temp=temp->next;
     }
 }
 int main (){
     int n;
     scanf("%d",&n);
     if(n<=0){
         printf("Invalid input");
         return 0;
     }
     for (int i=0;i<;i++){
         int a;
         if(!scanf("%d",&a)){
     }
 }