import java.io.*;
public class Main {
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = null;
while((str = br.readLine())!=null){
int num = Integer.parseInt(str);
String[] numStr = br.readLine().split(" ");
int num2 = Integer.parseInt(br.readLine().trim());
if(num2<=0||num2>numStr.length){
System.out.println(num2);
}else{
System.out.println(numStr[numStr.length-num2]);
}
}
}
}