#include <iostream>
#include <algorithm>
using namespace std;

const int N = 1001;
int a[N];

int main() {
    int n;
    while(cin >> n){
        for(int i = 0; i < n; i ++)
            cin >> a[i];
        sort(a, a + n);
        int num;
        cin >> num;
        int k = 1;
        int i = 0;
        while(i < n){
            if(i != 0 && a[i] > a[i - 1]){
                k ++;
            }
            if(k == num){
                cout << a[i] << endl;
                break;
            }
            i ++;
        }

    }
    return 0;
}
// 64 位输出请用 printf("%lld")