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