#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 100010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 97;
const unsigned long long BS1 = 10000019ULL;
const int INF = (1 << 29);
template <class T>
inline void fastScan(T &x) {
  register char c = getchar();
  int neg = 0;
  x = 0;
  for (; (c < 48 || c > 57) && (c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
int n;
int inp[N];
int dp[105][50000];
int f(int hand, int x, int y) {
  int how = hand / x;
  return (hand % x) + how * y;
}
int go(int pos, int hand) {
  if (pos > n) {
    return hand;
  }
  if (dp[pos][hand] != -1) {
    return dp[pos][hand];
  }
  int ret = go(pos + 1, hand);
  for (int j = pos + 1; j <= n; j++) {
    if (inp[j] > inp[pos]) {
      ret = max(ret, go(j + 1, f(hand, inp[pos], inp[j])));
    }
  }
  return dp[pos][hand] = ret;
}
int main() {
  fastScan(n);
  for (int i = 1; i <= n; i++) {
    fastScan(inp[i]);
  }
  memset(dp, -1, sizeof dp);
  printf("%d\n", go(1, 1000));
}
