class Node(object):
def __init__(self,data, next = None):
self.data = data
self.next = next
class LinkList(object):
def __init__(self, node=None):
self.__head = None
def isempty(self):
return self.__head==None
def append(self,item):
node = Node(item)
if self.isempty():
self.__head = node
else:
cur = self.__head
while cur.next != None:
cur = cur.next
cur.next = node
def pos_search(self,long,pos):
cur = self.__head
cur_c = 0
if pos <= 0:
print("0")
return False
else:
while cur != None:
cur_c += 1
if cur_c == (long-pos+1):
print(cur.data)
return True
else:
cur = cur.next
return False
if __name__ == "__main__":
while True:
try:
long = int(input())
string = input()
pos = int(input())
item = string.split(" ")
ll = LinkList()
for i in range(long):
n = item[i]
ll.append(n)
ll.pos_search(long, pos)
except:
break