#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template <class T>
inline void chmin(T& a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chmax(T& a, T b) {
  if (a < b) a = b;
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& v) {
  o << "{";
  for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
  o << "}" << endl;
  return o;
}
long long modinv(long long a, long long m = 1e9 + 7) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long const mod = 1e9 + 7;
const int MAX = 510000;
const long long MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
  int N, a, c = 0;
  cin >> N;
  vector<int> A(1, 201);
  for (int i = 0; i < N; i++) {
    cin >> a;
    if (c > 0 && A[c] == a)
      continue;
    else {
      A.push_back(a);
      c++;
    }
  }
  A.push_back(99);
  N = c + 2;
  long long m = 1000, s = 0;
  cout << A << c + 1 << endl;
  for (int i = (1); i < (c + 1); ++i) {
    if ((A[i - 1] < A[i] && A[i] < A[i + 1]) ||
        (A[i - 1] > A[i] && A[i] > A[i + 1])) {
      continue;
    } else if (A[i - 1] < A[i] && A[i] > A[i + 1]) {
      m += s * A[i];
      s = 0;
    } else {
      s += m / A[i];
      m -= m / A[i] * A[i];
    }
  }
  cout << m << endl;
}
