#include <bits/stdc++.h>
using namespace std;
struct node
{
struct node* prev;
int data;
struct node* next;
}*first=NULL;
void create(int a[],int n)
{
struct node *t,*last;
int i;
first=new node;
first->data=a[0];
first->prev=first->next=NULL;
last=first;
for(i=0;i<n;i++)
{
t=new node;
t->data=a[i];
t->next=last->next;
t->prev=last;
last->next=t;
last=t;
}
}
int lenth(struct node *p)
{
int len=0;
while(p)
{
len++;
p=p->next;
}
return len;
}
int main()
{
int a[]={10,20,30,40,50};
create(a,5);
cout<<length(first);
display(first);
return 0;
}