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 divisors = {}; function biggestDivisor(number) { if (divisors[number]) { return divisors[number]; } const max = Math.floor(Math.sqrt(number)); let divisor = 2; while ((number % divisor !== 0) && divisor <= max) { divisor += divisor === 2 ? 1 : 2; } if (divisor <= max) { divisors[number] = number / divisor; return number / divisor; } divisors[number] = number; return number; } function longestStickSequence(length) { if (length === 1) { return 1; } let moves = length + 1; let previous = length; let divisor = biggestDivisor(previous); while (divisor !== 1 && divisor !== previous) { previous = divisor; moves += divisor; divisor = biggestDivisor(divisor); } return moves; } function longestSequence(lengths) { let total = 0; for (let i = 0, l = lengths.length; i < l; i++) { total += longestStickSequence(lengths[i]); } return total; } function main() { var n = parseInt(readLine()); a = readLine().split(' '); a = a.map(Number); var result = longestSequence(a); process.stdout.write("" + result + "\n"); }