#include
using namespace std;
class node
{
public:
int data;
node *next;
node(int d)
{
data=d;
next=NULL;
}
};
node *head=NULL;
void find()
{
node *slow=head;
node *fast=head->next;
while(fast!=NULL && fast->next!=NULL)
{
fast=fast->next->next;
slow=slow->next;
}
cout<<slow->data;
}
void Create()
{
int n;
cin>>n;
head=new node(n);
node *t=NULL;
node *tail=head;
while(n!=-1)
{
cin>>n;
t=new node(n);
tail->next=t;
tail=t;
}
}
int main()
{
Create();
find();
}