// editor3
#include<stdio.h>
#include<stdlib.h>
void diaplay();
void create(int num)

typedef struct node{
    int data;
    struct node *next;
}node;
*node,*head=NULL,*tail;

int main(){
    int i,size,num;
    scanf("%d",&size);
    if(size<0){
        printf("Invalid input");
        return 0;
    }
    
    for(i=0;i<size;i++){
        scanf("%d",&num);
        create(num);
        
    }
    display();
}

void create(int num)
{
    newnode=(node*)malloc(sizeof(node));
    newnode->next=NULL;
    newnode->data=num;
    if(head==NULL)
    {
        head = newnode;
        tail = newnode;
    }
    else{
        tail->next=newnode;
        tail->newnode;
    }
}

void diaplay()
{
    node *temp;
    for(temp=head->next;temp!=NULL;temp=temp->next);
    printf("%d",temp->data);
}