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 _ = require('lodash'); function longestSequence(a) { // Return the length of the longest possible sequence of moves. let result = 0; a.forEach(size => { const dividers = []; const loopEnd = Math.sqrt(size) + 0.1 /* floating point safety */; let x = size; for (let i = 2; i <= loopEnd; i += 2) { while (x % i == 0) { dividers.push(i); x /= i; } if (i == 2) { // Adjust start, because skipping all even numbers i = 1; } } if (x > 1) { dividers.push(x); // Add last } let stepsTotal = size /* eating steps */; let currentPartSize = size; let haveParts = 1; for (let i = dividers.length - 1; i >= 0; i--) { const splitParts = dividers[i]; stepsTotal += haveParts; // One breaking step per each part currentPartSize /= splitParts; // Reduce current part haveParts *= splitParts; // Increase parts size } //console.log(size, stepsTotal, dividers); result += stepsTotal; }); return result; } function main() { var n = parseInt(readLine()); a = readLine().split(' '); a = a.map(Number); var result = longestSequence(a); process.stdout.write("" + result + "\n"); }