#include<stdio.h>
#include<stdlib.h>

typedef struct Node{
    int data;
    struct Node* next;
    struct Node* prev;
}Node;
Node* createNode(int data){
    Node*newNode=(Node*)malloc(sizeof(Node));
    if(!newNode){
        printf("Memory error\n");
        return NULL;
    }
    newNode->data=data;
    newNode->next=newNode->prev=NULL;
    return newNode;
}
int findLargest(Node*head){
    int maxVal=head->data;
    Node*temp=head;
    while(temp!=NULL){
        if(temp->data->maxVal){
            maxVal=temp->data;
        }
        temp=temp->next;
    }
    return maxVal;
}
int main(){
    int n;
    scanf("%d ",&n);
}
Node*head=createNode(values[0]);
Node*temp=head;
for(int i=1;i<n;i++){
    Node*newNode=createNode(values[i]);
    temp->next=newNode;
    newNode->prev=temp;
    temp=temp->next;
}   
    printf("%d\n",findLargest(head));
    return 0;
}