#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  ;
  vector<int> v(n);
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  ;
  int diff = 0;
  int ans = v[0];
  for (int i = 0; i < n - 1; i++) {
    diff += (v[i] - v[i + 1]);
    if (diff < 0) {
      ans = ans + abs(diff);
      diff = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
