import java.util.Scanner;
public class Main {
    public static void main(String[] args) { 
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int n = in.nextInt();
            int[] data = new int[n];
            for(int i = 0; i<n; i++){
                data[i] = in.nextInt();
            }
            int rearIndex = in.nextInt();
            ListNode head = new ListNode(0,null);
            for(int i = 0; i<n; i++){
                ListNode node = head;
                    while(node.next != null){
                        node = node.next;
                    }
                node.next = new ListNode(data[i],null);
            }   
            ListNode no = head.next;
            if(rearIndex==0){
                System.out.println(0);
            }else{
                for(int j = 0; j<n-rearIndex; j++){
                    no = no.next;
                }
            System.out.println(no.key);
            }
        } 
    }
}
class ListNode{
    int key;
    ListNode next;
    ListNode(int key, ListNode n){
        this.key = key;
        this.next = n;
    }
}