#include <bits/stdc++.h>
using namespace std;
int solve() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  long long ct = 0, mx = v[0];
  for (auto &it : v) cin >> it;
  for (int i = 1; i < n; i++) {
    ct += max(0LL, v[i - 1] - v[i]);
    mx = max(mx, v[i]);
  }
  cout << mx << endl;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
