#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y, max, min, b;
  int a[n];
  y = -1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = i; j >= 0; j--) {
      x = a[i] - a[j];
      if (x > y) {
        max = a[i];
        min = a[j];
        y = x;
      }
    }
  }
  int sum, c, d, e;
  c = 1000 / min;
  d = max * c;
  e = 1000 % c;
  sum = d + c;
  cout << sum;
  return 0;
}
