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 getDelimeters = (n) => { let result = []; while (n !== 1) { for (let i = 2; i <= n; i++) { if (n % i === 0) { result.push(i); n = n / i; break; } } } return result.sort((a, b) => a < b); } function longestSequence(a) { let result = 0; for (let i = 0; i < a.length; i++) { const delimeters = getDelimeters(a[i]); let lastN = 1; result+=lastN; for (let j = 0; j < delimeters.length; j++) { lastN = delimeters[j] * lastN; result += lastN; } } return result; } function main() { var n = parseInt(readLine()); a = readLine().split(' '); a = a.map(Number); var result = longestSequence(a); process.stdout.write("" + result + "\n"); }