#include <stdlib.h>
#include <stdio.h>
int
a[1000001],n,ans = -1;
void
swap(
int
*a,
int
*b)
{
int
c;
c = *a; *a = *b; *b = c;
}
int
FindKth(
int
left,
int
right,
int
n)
{
int
tmp,value,i,j;
if
(left == right)
return
left;
tmp =
rand
()% (right - left) + left;
swap( &a[tmp], &a[left] );
value = ①
i = left;
j = right;
while
(i < j)
{
while
(i < j && ② ) j --;
if
(i < j) {a[i] = a[j]; i ++;}
else
break
;
while
(i < j && ③ ) i ++;
if
(i < j) {a[j] = a[i]; j - -;}
else
break
;
}
④
if
(i < n)
return
FindKth( ⑤ );
if
(i > n)
return
⑥
return
i;
}
int
main()
{
int
i;
int
m = 1000000;
for
(i = 1;i <= m;i ++)
scanf
(
"%d"
, &a[i]);
scanf
(
"%d"
, &n);
ans = FindKth(1,m,n);
printf
(
"%d\n"
, a[ans]);
return
0;
}