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