#include<stdio.h>
#include<stdlib.h>

typedef int datatype;
typedef struct node{
	datatype num;
	struct node *next;
}list;
//单链表结构体 

//输出结果 
int output(list *head,int k)
{
	int j = 1;//计数器 
	list *p;
	p = head->next;//p指向第一个数据 
	while(p != NULL)//如果p存在数据 
	{
		if(j == k)//如果找到相应位置 
		{
			printf("%d\n",p->num);//输出数据 
			return 1;//返回1表示成功 
		}
		else
		{
			p = p->next;//否则遍历。继续找 
			j++;
		}
	}
	printf("Not Found\n");//遍历结束时j依然不等于k，查找失败 
	return 0;//返回0表示失败 
}

//i为插入的位置，x为插入的数据 
void insert(list *head, int i, datatype x)
{
	int j = 0;
	list *p;
	list *s;
	p = head;
	while(p->next != NULL && j < i-1)//判断插入位置 
	{
		p = p->next;
		j++;
	}
	if(p != NULL)
	{
		s = (list *)malloc(sizeof(list));//申请空间储存新数据 
		s->num = x;
		s->next = p->next;//s保存p的数据 
		p->next = s;//s成为p的下一个节点，即s插入到p前面 
	}
} 

int main()
{
	const int loc = 1;//数据添加的位置，
	list* head;
	head = (list*)malloc(sizeof(list));//为head申请空间 
	head->next = NULL;//初始化 
	datatype num = 0; //加入的数据 
	int k = 0;//倒数第k位 
	scanf("%d", &k);
	while(scanf("%d",&num) != EOF)
	{
		insert(head,loc,num);//新增数据永远放在第一个，即头插 
	}
	output(head, k);
	return 0;
	
}
