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