process.stdin.resume(); process.stdin.setEncoding('ascii'); var input_stdin = ""; var input_stdin_array = ""; var input_currentline = 0; process.stdin.on('data', function (data) { input_stdin += data; }); process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); }); function readLine() { return input_stdin_array[input_currentline++]; } /////////////// ignore above this line //////////////////// const ls = { 0: 0, 1: 1, }; function getMin(n) { if (n < 4) { return 1; } else { return 2; } } function longestSequence(a) { var target = 2; // already have 1 and 2 as base cases. while(target <= a) { var max = ls[target - 1] + 1; for(var i = getMin(target); Math.pow(i, 2) <= target; i++) { var isDivisible = target % i === 0; if (isDivisible) { var positions = target / i; max = Math.max(max, positions * ls[i] + 1); } } ls[target] = max; target++; } return ls[a]; } function main() { var n = parseInt(readLine()); a = readLine().split(' '); a = a.map(Number); var result = a.reduce((sum, v) => sum + longestSequence(v), 0); process.stdout.write("" + result + "\n"); }