#include<iostream>#include<cstdio>using namespace std;int main(){ int n,i,a[i]; while(cin>>n) { for(i=0;i<n;i++) { cin>>a[i]; } i--; int max=0; while(i>=0) { if(a[i]>max) max=a[i]; i--; } cout<<max<<endl; }}