#include <bits/stdc++.h>
using namespace std;
const int N = 1E5 + 9;
int arr[N];
string convert(long long int n) {
  string temp = "";
  while (n) {
    if (n % 2) {
      temp += '1';
    } else
      temp += '0';
    n = n / 2;
  }
  reverse(temp.begin(), temp.end());
  return temp;
}
long long int power(long long int n) {
  long long int res = 1;
  while (n) {
    res = 2 * n;
    n--;
  }
  return res;
}
long long int binary(string s) {
  long long int res = 0;
  long long int cnt = 0;
  for (int i = s.size() - 1; i >= 0; --i) {
    if (s[i] == '1') res += power(cnt);
    cnt++;
  }
  return res;
}
bool b[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  multiset<int> st;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    st.insert(arr[i]);
  }
  int index = 0, curr = 0;
  long long int maxi = 0, res = 0;
  for (int i = 0; i < n; ++i) {
    st.erase(st.find(arr[i]));
    if (st.size() && arr[i] < *(st.rbegin())) {
      res = abs(*(st.rbegin()) - arr[i]);
      if (res > maxi) {
        maxi = res;
        curr = *(st.rbegin());
        index = i;
      }
    }
  }
  cout << curr * (1000 / arr[index]);
  return 0;
}
