#include < iostream >

using namespace std;

struct node

{

int data;

struct node *next;

};

```
int main()
{
int a,d;
node *head=new node;
node *tail=new node;
node *temp=new node;
cin>>a;
int k;
a++;
k=a;
while(a--)
{
cin >> d;
if(--k==a)
{
head->data=d;
tail=head;
k++;
}
else
{
node *temp=new node;
temp->data=d;
tail->next=temp;
temp->next=NULL;
tail=temp;
}
}
temp=head;
cin>>d;
while(d)
{
head=head->next;
d--;
}
temp=head;
cout<<"\nLinked List\n";
while(temp->next!=NULL)
{
cout<<"->"<<temp->data;
temp=temp->next;
}
return 0;
}
```