// editor3
#include<stdio.h>
#include<stdlib.h>
struct node
{
    int item;
    struct node*next;
}node;
 struct node*createnode(int item)
{
     struct node*newnode=(struct node*)malloc(sizeof(node));
    if(!newnode)
    {
        printf("memory allocation is failed\n");
        exit(1);
    }
    newnode->item=item;
    newnode->next=NULL;
    return newnode;
}
void deleteatlast(node*head)
{
    node*temp=head;
    while(temp->next->next!=NULL){
        temp=temp->next;
        tail=temp;}
        free(temp->next);
        tail=next=NULL;
}
void printlist(node*head){
    while(head){
        printf("%d",head->data);
        head=head->next;
    }
}
int main()
{
    int n, k,s;
    scanf("%d",n);
    node*newnode=createnode(s);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&s);
        if(head==NULL){
            head=tail=newnode;
        }
        else{
            tail->next=newnode;
            tail=newnode;
        }
    }
    scanf("%d",&k);
    for(int i=0;i<n;i++)
    deleteatlast(head);
    printlist(head);
}