#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline int popcount(const int x) { return __builtin_popcount(x); }
template <class T>
void chmin(T &a, const T &b) noexcept {
  if (b < a) a = b;
}
template <class T>
void chmax(T &a, const T &b) noexcept {
  if (a < b) a = b;
}
template <class T>
void drop(const T &x) {
  std::cout << x << endl;
  exit(0);
}
void debug_out() { std::cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &...args) {
  std::cout << x << " ";
  debug_out(args...);
}
struct InitIO {
  InitIO() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
  }
} init_io;
template <typename T>
struct SegmentTree {
 private:
  using F = function<T(T, T)>;
  const F f;
  const T DD;
  int n;
  vector<T> dat;

 public:
  SegmentTree(int n_, const F func, T dd) : f(func), DD(dd) { init(n_); }
  void init(int n_) {
    n = 1;
    while (n < n_) n *= 2;
    dat.clear();
    dat.resize(2 * n - 1, DD);
  }
  void build(int n_, vector<T> v) {
    assert(n_ <= n);
    for (int i = 0; i < n_; ++i) dat[i + n - 1] = v[i];
    for (int i = n - 2; i >= 0; --i) dat[i] = f(dat[2 * i + 1], dat[2 * i + 2]);
  }
  void set_val(int i, T x) {
    assert(i < n);
    i += n - 1;
    dat[i] = x;
    while (i > 0) {
      i = (i - 1) / 2;
      dat[i] = f(dat[i * 2 + 1], dat[i * 2 + 2]);
    }
  }
  T query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l)
      return DD;
    else if (a <= l && r <= b)
      return dat[k];
    else {
      T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return f(vl, vr);
    }
  }
  T query(int a, int b) {
    assert(a < n);
    assert(b <= n);
    return query(a, b, 0, 0, n);
  }
  T operator[](const int &k) const {
    assert(k < n);
    return query(k, k + 1);
  }
};
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  using P = pair<int, int>;
  vector<P> b;
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
    if (i > 0 and a[i - 1] != a[i]) b.emplace_back(P(a[i], i));
  }
  auto f = [&](int x, int y) { return min(x, y); };
  SegmentTree<int> seg(n, f, 1001001001);
  seg.build(n, a);
  sort((b).begin(), (b).end(), greater<P>());
  int ans = 0;
  for (int x = 0; x < (n / 2 + 2); ++x) {
    if (b.size() < x) break;
    int now = 1000, l = 0;
    vector<P> c(x);
    for (int i = 0; i < (x); ++i) c[i] = P(b[i].second, b[i].first);
    sort((c).begin(), (c).end());
    for (int i = 0; i < (x); ++i) {
      if (l == n) break;
      int ind = c[i].first;
      if (ind == l) continue;
      int mini = seg.query(l, ind);
      int num = now / mini;
      now -= mini * num;
      now += num * c[i].second;
      ;
      l = ind + 1;
    }
    chmax(ans, now);
  }
  cout << ans << endl;
  return 0;
}
