#include <ios>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

std::vector<long long int> factors;
std::vector<long long int> dp;
std::map<long long int, long long int> stored;

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);
    int n;
    long long int x, ans = 0;
    std::cin >> n;
    for (int i = 0; i < n; i++)
    {
        std::cin >> x;
        for (long long int j = 1; j*j <= x; j++)
        {
            if (x % j == 0)
            {
                factors.push_back(j);
                if (x/j > j)
                    factors.push_back(x/j);
            }
        }
        std::sort(factors.begin(), factors.end());
        for (std::vector<long long int>::iterator it = factors.begin(); it != factors.end(); it++)
        {
            if (stored.find(*it) == stored.end())
            {
                if (*it == 1)
                    dp.push_back(1);
                else
                {
                    long long int best_ans = *it+1;
                    for (std::vector<long long int>::iterator iq = factors.begin(); iq != it; iq++)
                    {
                        if (*it % *iq == 0 && dp[std::distance(factors.begin(), iq)]*(*it/ *iq) + 1 >= best_ans)
                            best_ans = dp[std::distance(factors.begin(), iq)]*(*it/ *iq) + 1;
                    }
                    dp.push_back(best_ans);
                }
                stored[*it] = dp[std::distance(factors.begin(), it)];
            }
            else
                dp.push_back(stored[*it]);
        }
        ans += dp[dp.size()-1];
        factors.clear();
        dp.clear();
    }
    std::cout << ans << '\n';
}