//土尔逊Torson 编写于2023/06/13
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <queue>

using namespace std;

int main() {
	int n;
	while (scanf("%d", &n) != EOF) {
		priority_queue<int> MyQueue;
		for (int i = 0; i < n; ++i) {
			int leaf;
			scanf("%d", &leaf);
			MyQueue.push(-leaf);
		}
		int k;
		scanf("%d", &k);
		while (--k) {
			int num = MyQueue.top();
			while (MyQueue.top() == num) {
				MyQueue.pop();
			}
		}
		printf("%d\n", -MyQueue.top());
	}
	system("pause"); 
	return EXIT_SUCCESS;
}
// 64 位输出请用 printf("%lld")