// editor2
// editor1
#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int data;
    struct node *next,*prev;

}nd;
nd *head=NULL,*tail=NULL;
void create(int num){
    nd *newnode=(nd*)malloc(1*sizeof(nd));
    newnode->data = num;
    if(head==NULL){
        head=tail=newnode;
else{
    tail->next=newnode;
    newnode->prev=prev;
    tail=newnode;
}
}
void dis(){
    int max=head->data;
    node *temp=head;
    while(temp!=NULL){
        if(temp->data>max){
            max=temp->data;
        }
        temp=temp->next;
    }
    printf("%d",max);
    
}
int main(){
    int n,num;
    scanf("%d",&n);
    if(n<=0){
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<n;i++){
        scanf("%d",&num);
        create(num);
    }
     dis();
    return 0;
}