#include <bits/stdc++.h>
using namespace std;
int _;
int main() {
  _ = 1;
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  while (_--) {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    long long small = -a[0];
    long long cur = small;
    for (int i = 0; i < n - 1; i++) {
      cur += a[i] - a[i + 1];
      small = min(small, cur);
    }
    cout << -small << '\n';
  }
  return 0;
}
