#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int ans = 0, a, b = 0, e = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a);
      e += b - a;
      if (e < 0) {
        ans -= e;
        e = 0;
      }
      b = a;
    }
    printf("%d\n", ans);
  }
  return 0;
}
