#include <bits/stdc++.h>
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a;
  for (int i = 0, i_len = (int)(n); i < i_len; i++) {
    int tmp;
    cin >> tmp;
    if (i == 0) {
      a.push_back(tmp);
      continue;
    }
    if (tmp != a.back()) a.push_back(tmp);
  }
  int sz = ((int)(a).size());
  long long ans = 1000, num = 0;
  for (int i = 0, i_len = (int)(sz); i < i_len; i++) {
    if (i == 0) {
      if (a[i] < a[i + 1])
        while (1) {
          if (ans - a[i] < 0) break;
          ans -= a[i];
          num++;
        }
    } else if (i == sz - 1) {
      if (a[i - 1] < a[i])
        while (num != 0) {
          ans += a[i];
          num--;
        }
    } else if (a[i - 1] < a[i] && a[i] > a[i + 1]) {
      while (num != 0) {
        ans += a[i];
        num--;
      }
    } else if (a[i - 1] > a[i] && a[i] < a[i + 1]) {
      while (1) {
        if (ans - a[i] < 0) break;
        ans -= a[i];
        num++;
      }
    }
    cerr << "ans"
         << " = " << (ans) << "\n";
    ;
    cerr << "num"
         << " = " << (num) << "\n";
    ;
  }
  cout << ans << "\n";
}
