#include <bits/stdc++.h>
using namespace std;
long long arr[80];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n;
  long long diff = 0;
  long long a = 1;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (long long i = 0; i < n; ++i) {
    long long max = 0;
    if (arr[i] > 1000) continue;
    for (int j = i; j < n; ++j) {
      if (arr[j] > max) max = arr[j];
    }
    if (diff < (max - arr[i])) diff = max - arr[i], a = arr[i];
  }
  cout << (diff) * (1000 / a) + 1000;
}
