#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << '\n';
  err(++it, args...);
}
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &a) {
  return os << '(' << a.first << ", " << a.second << ')';
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &a) {
  os << '[';
  for (unsigned int i = 0; i < a.size(); i++)
    os << a[i] << (i < a.size() - 1 ? ", " : "");
  os << ']';
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &a) {
  os << '{';
  for (typename set<T>::iterator it = a.begin(); it != a.end(); it++) {
    typename set<T>::iterator jt = it;
    os << *it << (++jt != a.end() ? ", " : "");
  }
  os << '}';
  return os;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, map<T1, T2> &a) {
  os << "{\n";
  for (typename map<T1, T2>::iterator it = a.begin(); it != a.end(); it++) {
    typename map<T1, T2>::iterator jt = it;
    os << "  " << it->first << ": " << it->second
       << (++jt != a.end() ? ",\n" : "\n");
  }
  os << '}';
  return os;
}
const long long INF = 1e18;
int n;
vector<int> a;
int S = sqrt(1e9);
long long ans = INF;
long long cal(int i) {
  long long curans = 0;
  for (auto X : a) {
    int limB = X / (i + 1);
    int remB = X % i;
    if (limB < remB) return INF;
    int B = ((limB - remB) / i) * i + remB;
    if (B < 0) return INF;
    int A = (X - B) / i - B;
    curans += A + B;
  }
  return curans;
}
void smallerThanSQRT() {
  for (int i = 1; i <= S; i++) ans = min(ans, cal(i));
}
void biggerThanSQRT() {
  sort(a.begin(), a.end());
  ;
  for (int AplusB = 1; AplusB <= (S + 1); AplusB++) {
    int mxb = a[0] - AplusB * S;
    if (mxb < 0) break;
    int B = mxb % AplusB;
    while (1) {
      int A = AplusB - B;
      int X = (mxb - B) / AplusB;
      if (A < 0) break;
      int sz = S + X;
      long long rec = cal(sz);
      if (rec == INF) {
        B += AplusB;
        continue;
      }
      ans = min(ans, rec);
      break;
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a.push_back(t);
  }
  smallerThanSQRT();
  biggerThanSQRT();
  cout << ans << '\n';
}
