#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int n;
    int k;
    priority_queue<int> que;
    while (scanf("%d", &n) != EOF) {
        while (!que.empty()) {
            que.pop();
        }
	  
        for (int i = 0; i < n; i++) {
            int t;
            scanf("%d", &t);
            que.push(-t); //底层是一个大根堆,所以存相反数变成小根堆
        }

        scanf("%d", &k);
        int i = 1;
        int pre;
        while (i != k) {
            pre = que.top();
            while (pre == que.top()) { //防止有重复的
                que.pop();
            }
            i++;
        }

        printf("%d\n", -que.top());
    }
}