#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>arr;
    for(int i=0; i<n;i++){
        int x;
        cin>>x;
        arr.push_back(x);
    }
    int index;
    cin>>index;
    try{
        if(index<0 || inex>=arr.size()){
            throw out_of_range("Array index out of bounds");
        }
        cout<<arr[index];
    }
    catch (out_of_range &e){
        cout<<-1;
    }
    return 0;
}