#include <bits/stdc++.h>
using namespace std;
int n;
vector<long long> v;
int dp[100][2000];
int main() {
  cin >> n;
  v.resize(n + 1);
  for (int i = 1, i_len = (n); i <= i_len; ++i) cin >> v[i];
  map<long long, long long> m[81];
  m[0][1000] = 0;
  for (int i = 1, i_len = (n); i <= i_len; ++i) {
    for (auto &p : m[i - 1]) {
      m[i][p.first] = p.second;
      m[i][p.first % v[i]] = p.second + p.first / v[i];
      m[i][p.first + v[i] * p.second] = 0;
    }
  }
  auto itr = m[n].rbegin();
  cout << (*itr).first << endl;
  return 0;
}
