#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);
    if(n<=0){
        printf("Invalid input\n");
        return 0;
    }
    int values[n];
    for(int i=0;i<n;i++){
        scanf("%d",&values[i]);
    }
    Node*head=createNode(values[0]);
    Node*temp=head;
    for(int i=1;i<n;i++){
        Node*newNode=createNode(value[i]);
        temp->next=newNode;
        newNode->prev=temp;
        temp=temp->next;
    }
    printf("%d\n",findLargest(head));
    return 0;
}