// Problem#: 1157
// Author#: Reid Chan
#include <iostream>
using namespace std;
int main() {
int t;
while (cin >> t && t != 0) {
int num, max;
for (int i = 0; i < t; ++i) {
cin >> num;
if (i == 0) {
max = num;
} else {
if (num > max) {
max = num;
}
}
}
cout << max << endl;
}
return 0;
}