// editor4
#include<stdio.h>
#include<stdlib.h>
struct Node
{
    int data;
    struct Node *next;
    struct Node *prev;
};
struct Node *create(int data)
{
    struct Node *newnode=(struct Node *)malloc(sizeof(struct Node));
    newnode->data=data;
    newnode->next=NULL;
    newnode->prev=NULL;
    return newnode;
}
void insert(int data,struct Node **head)
{
    struct Node *newnode=create(data),*temp=*head;
    if(*head==NULL)
    {
        *head=newnode;
    }
    else
    {
        while(temp->next!=NULL)
        {
            temp=temp->next;
        }
        temp->next=newnode;
        newnode->prev=temp;
    }
}
void sort(struct Node *temp)
{
    struct Node *index=temp;
    while(index!=NULL)
    {
        temp=index->next;
        while(temp!=NULL)
        {
            if(index->data<temp->data)
            {
                int data=index->data;
                index->data=temp->data;
                temp->data=data;
            }
            temp=temp->next;
        }
        index=index->next;
    }
}
void delt(int pos,struct Node **head)
{
    struct Node *temp=*head,*chumma;
    int i=0;
    while(i<pos)
    {
        temp=temp->next;
        i++;
    }
    chumma=temp->next->next;
    temp->next=chumma;
    chumma->prev=temp;
}
int main()
{
    int n;
    scanf("%d",&n);
    if(n<2)
    {
        printf("List is empty");
        return 0;
    }
    struct Node *head;
    for(int i=0;i<n;i++)
    {
        int data;
        if((scanf("%d",&data)!=1)
        {
            printf("Invalid input");
            return 0;
        }
        insert(data,&head);
    }
    
}