using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static List primes; static long longestSequence(long[] a) { long totalMoves = a.Sum(); for (int i = 0; i < a.Length; i++) { if (a[i] == 1) continue; int pos = 0; while (a[i] > 1 && pos < primes.Count && a[i] >= primes[pos]) { if (a[i] % primes[pos] == 0) { totalMoves += a[i] / primes[pos]; a[i] /= primes[pos]; } else { pos++; } } if (a[i] > 1) totalMoves++; } return totalMoves; } static void Main(String[] args) { fillPrimes(); 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); } static void fillPrimes() { var composite = new bool[1000000]; primes = new List(); for (int i = 2; i < 1000000; i++) { if (!composite[i]) primes.Add(i); for (int j = 0; j < primes.Count && (long)i * primes[j] < 1000000; j++) { composite[i * primes[j]] = true; if (i % primes[j] == 0) break; } } } }