#include<stdio.h>
#include<stdlib.h>
typedef struct list
{
    int data;
    struct list *next,*prev;
}node;
node *head=NULL,*tail=NULL;
void create(int n)
{
    node *nd=(node*)malloc(sizeof(node));
    nd->data=n;
    nd->next=nd->prev=NULL;
    if(head==NULL)
    {
        head=tai=nd;
    }
    else
    {
        tail->next=nd;
        nd->prev=tail;
        tail=nd;
    }
}
void print()
{
    node *temp=head;
    while(temp!=NULL)
    {
        node *temp2=temp->next;
        while(temp2!=NULL)
        {
            if(temp->data==temp2->data)
            {
                if(temp2->next==NULL)
                {
                    temp2->prev->next=NULL;
                    tail=temp2->prev;
                    break;
                }
                else
                {
                    temp2->next->prev=temp2->prev;
                    temp2->prev->next=temp2->next;
                }
            }
            temp2=temp2->next;
        }
        temp=temp->next;
    }
    node *ptr=head;
    while(ptr!=NULL)
    {
        printf("\n%d",ptr->data);
        ptr=ptr->next;
    }
}
int main()
{
    int n;
    scanf("%n",&n);
    if(n<0)
    {
        printf("Invalid Input");
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        int data;
        scanf("%d",&data);
        create(data);
    }
    print();
}