using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { public static long GetMinFactor(long n) { for (var i = 2; i <= Math.Sqrt(n); i++) if (n % i == 0) return i; return -1; } public static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long numMoves = 0; for (var i = 0; i < a.Length; i++) { // Process Stick var stickSize = a[i]; if (stickSize == 1) { numMoves++; continue; } while (stickSize > 0) { numMoves += stickSize; var minFactor = GetMinFactor(stickSize); if (minFactor == -1) { // Prime numMoves++; break; } stickSize = stickSize / minFactor; } } return numMoves; } static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] a_temp = Console.ReadLine().Split(' '); long[] a = Array.ConvertAll(a_temp,Int64.Parse); long result = longestSequence(a); Console.WriteLine(result); } }