#include <iostream>
using namespace std;
int quick_sort(int a[], int l, int r, int k)
{
int i,j;
i = l; j = r;
int x = a[l];
int t = a[l]; a[l] = a[r]; a[r] = t;
while (i < j)
{
while (i < j && a[i]<x) i++;
if (i < j)
{
a[j] = a[i];
j--;
}
while (i<j && a[j]>x) j--;
if (i < j)
{
a[i] = a[j];
i++;
}
}
a[i] = x;
if (i - l + 1 == k) return a[i];
else if (i - l + 1 < k) return quick_sort(a, i + 1, r, k - (i - l + 1));
else return quick_sort(a,l,i-1,k);
}
int main()
{
int k;
int a[] = {4,5,8,6,0,10,3,5,21,7};
int N = sizeof(a) / sizeof(a[0]);
cin >> k;
cout << quick_sort(a, 0, N - 1, k) << endl;
return 0;
}