#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector vi; typedef pair pi; typedef pair pl; inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;} inline ll toll(string s){ll v; istringstream sin(s);sin>>v;return v;} template inline string toString(T x) { ostringstream sout; sout << x; return sout.str();} #define MAX (10000000 + 5) #define ff first #define ss second #define PI acos(-1.0) #define mp make_pair #define INF 2e9 #define llINF 4e18 #define EPS 1e-9 #define sz(v) static_cast((v).size()) #define pb(...) push_back(__VA_ARGS__) #define clr(x) memset(x, 0, sizeof(x)) #define rep(i, b) for (int i = 0 ; i < (b) ; ++i) #define rep1(i, b) for (int i = 1 ; i <= (b) ; ++i) ll ans[2000000]; ll res[200]; int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n; cin >> n; vector v(n); for(int i = 0 ; i < n ; i++) cin >> v[i]; ans[1] = 1; for(ll i = 1 ; i * i <= 1000000000000 ; i++){ for(ll j = i + i; j * j <= 1000000000000 ; j += i) ans[j] = max(ans[i] * (j / i) + 1, ans[j]); for(int j = 0 ; j < n ; j++) { if(v[j] > i) { if(v[j] % i == 0) { res[j] = max((v[j] / i) * ans[i] + 1 , res[j]); } } } } ll sum = 0; for(int i = 0 ; i < n ; i++) { sum += res[i]; if(v[i] == 1) sum++; } cout << sum << endl; return 0; }