// Problem#: 1157
// Submission#: 3810711
// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/
// All Copyright reserved by Informatic Lab of Sun Yat-sen University
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
while(cin >> n&&n!=0)
{
int num[n];
int max=0;
for(int i=0;i<n;i++)
{
int s;
cin >> s;
num[i]=s;
}
sort(num,num+n);
cout << num[n-1] << endl;
}
return 0;
}