#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int h[100000], i;
  for (i = 0; i < n; ++i) scanf("%d", &h[i]);
  long long sum = -h[0], min = -h[0];
  for (i = 1; i < n; ++i) {
    sum += h[i - 1] - h[i];
    if (sum < min) min = sum;
  }
  printf("%I64d\n", -min);
  return 0;
}
