#include
using namespace std;
class node
{
public:
node *prev;
int data;
node *next;
node(int d)
{
prev=NULL;
data=d;
next=NULL;
}
};
void Display(node *p)
{
while(p!=NULL)
{
cout<data<<" ";
p=p->next;
}
cout<<endl;
}
node * Create(node *head,int n)
{
int ele;
cin>>ele;
head=new node(ele);
node *last=head;
for(int i=0;i<n-1;i++)
{
cin>>ele;
node *t=new node(ele);
t->prev=last;
last->next=t;
last=t;
}
return head;
}
bool isPalindrome(node *head)
{
node *p=head;
node *q=head;
while(q->next!=NULL)
{
q=q->next;
}
while(p->next!=q || p!=q)
{
if(p->data==q->data)
{
p=p->next;
q=q->prev;
}
else
return false;
}
return true;
}
int main()
{
int n;
cin>>n;
node *head=NULL;
head=Create(head,n);
bool temp=isPalindrome(head);
if(temp)
cout<<“true”;
else
cout<<"false";
}