int main()
{
    fast_IO
    int n; cin >> n;
    vector<int> a(n);
    for (auto &A : a) cin >> A;
    int mx = 1000;
    for (int i = 0; i+1 < n; i++)
        for (int j = i+1; j < n; j++)
        {
            if (a[j] > a[i])
            {
                int x = floor(1000 / a[i]);
                mx = max(mx, 1000 - a[i] * x + a[j] * x);
            }
        }
    cout << mx << '\n';
    return 0;
}