#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main(){
    int n;
    while(cin >> n){
        priority_queue<int, vector<int>, greater<int>> q;
        while (n --) {
            int x;
            cin >> x;
            q.push(x);
        }
        int num;
        cin >> num;
        while (--num) {
            int k = q.top();
            q.pop();
            while(q.top() == k)
                q.pop();
        }
        cout << q.top() << endl;
    }

    return 0;
}