#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const auto infinity = numeric_limits<ll>::max();
int mod(const int x, const int m) { return x % m >= 0 ? x % m : x % m + m; }
int fld(const int x, const int y) { return (x - mod(x, y)) / y; }
int main() {
  int n;
  cin >> n;
  auto boxes = vector<int>(n);
  for (auto& x : boxes) cin >> x;
  const auto try_size = [&](const int m) {
    auto result = 0LL;
    for (const auto a : boxes) {
      const auto a1 = mod(-a, m + 1), a2 = a + fld(-a, m + 1) * m;
      if (a2 < 0)
        return infinity;
      else
        result += a1 + a2;
    }
    return result;
  };
  auto result = infinity;
  for (auto m = 1; m * m <= boxes[0]; m++) result = min(result, try_size(m));
  for (auto k = 1; k * k <= boxes[0]; k++) {
    const auto m = boxes[0] / k;
    result = min(result, try_size(m));
    if (boxes[0] % k == 0) result = min(result, try_size(m - 1));
  }
  cout << result << endl;
}
