#include using namespace std; #define pb push_back #define mp make_pair #define F first #define S second #define fo(i, n) for(int i = 1; i <= n; ++i) typedef long long ll; typedef pair pii; typedef pair pll; const int N = 200200; const int mod = 1e9 + 7; map was; ll n, a[200], ans; inline void process(ll x) { vector del; for(ll i = 1; i * i <= x; ++i) if(x % i == 0) { del.pb(i); if(i * i != x) del.pb(x / i); } sort(del.begin(), del.end()); for(int i = 1; i < del.size(); ++i) { ll cur = del[i]; if(was.count(cur)) continue; int cnt = 0; for(int j = i - 1; j >= 0 && cnt < 100; --j) if(cur % del[j] == 0) was[cur] = max(was[cur], was[del[j]] * (cur / del[j]) + 1), ++cnt; } } int main() { cin >> n; fo(i, n) cin >> a[i]; was[1] = 1; fo(i, n) process(a[i]), ans += was[a[i]]; cout << ans; return 0; }