#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int x = 0, y, n, ans = 0, bal = 0;
  cin >> n;
  while (n--) {
    cin >> y;
    bal += x - y;
    ans = min(ans, bal);
    x = y;
  }
  cout << -ans << '\n';
  return 0;
}
