#include<stdio.h>
#include<stdlib.h>

struct Node{
    int data;
    struct Node* next;
    struct Node* prev;
};

struct Node* createNode(int value){
    struct Node* newNode=(struct Node*)malloc(sizeof(struct Node));
    newNode->data=value;
    newNode->next=NULL;
    newNode->prev=NULL;
    return newNode
}

int findlargest(struct Node* head){
    int max=head->data;
    struct Node* temp=head;
    while(temp!=NULL){
        if(temp->data>max){
            max=temp->data;
        }
        temp=temp->next;
    }
    return max;
}

int main(){
    int n;
    scanf("%d",&n);
    
    if(n<=0){
        printf("Invalid input");
        return 0;
    }
    
    struct Node* head=NULL;
    struct Node* tail=NULL;
    
    for(int i=0;i<n;i++){
        int value;
        scanf("%d",&value);
        struct Node* newNode=createNode(value);
        
        if(head==NULL){
            head=newNode;
            tail=newNode;
        }
        else{
            tail->next=newNode;
            newNode->prev=tail;
            tail=newNode;
        }
    }
    
    int largest=findlargest(head);
    printf("%d",largest);
    
    return 0;
}