#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  cin >> n;
  n += 1;
  int h[n];
  for (int i = 1; i < n; i++) cin >> h[i];
  h[0] = 0;
  int energy = 0;
  int max_energy = 0;
  for (int i = 0; i < (n); ++i) {
    if (i == 0) continue;
    energy += h[i - 1] - h[i];
    max_energy = min(max_energy, energy);
  }
  cout << -max_energy << endl;
  return 0;
}
