#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 val){
    Node *newnode = (Node*)malloc(sizeof(Node));
    
    newnode->data=val;
    newnode->next=NULL;
    newnode->prev=NULL;
    
    if(head==NULL){
        head=tail=newnode;
    }
    else{
       tail->next=newnode;
       newnode->prev=newnode;
       tail=newnode;
    }
    
}

void sort(){
    
    Node *i,*j;
    
    for(i=head;i !=NULL ;i=i->next){
        for(i=head;i !=NULL ;i=i->next){
            if(i->data < j->data){
                int temp=i->data;
                i->data=j->data;
                j->data=temp;
            }
            
        }
    }
    
}
void display(int k){
    
    Node *temp=prev;
       for(int i=0 ;i<k;k++){
        temp=temp->prev;
    }
    
    printf("%d ",temp->data);
}




int main(){
    int n,val,k;
     scanf("%d",&n);
     if(n <=0){
         printf("Invalid input");
         return 0;
     }
     
     for(int i=0 ; i<n ; i++){
         scanf("%d",&val);
         create(val);
     }
     scanf("%d",&k);
     display(k);
    
    
    return 0;
}