n = int(input()) num = list(map(int, input().split(" "))) x = int(input()) - 1 ct = 0 num.sort() if n > 1: for i in range(n - 1): if num[i] < num[i + 1]: ct += 1 ans = num[i + 1] if ct == x: break else: ans = num[0] print(ans)