using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static long longestSequence(long[] aa) { // Return the length of the longest possible sequence of moves. long result = 0; foreach (long a in aa) { long b = a; if (b == 1) { result++; continue; } result += b; int r = (int)Math.Sqrt(b); for (int j = 2; j <= r; j++) { while (b % j == 0) { b /= j; result += b; } if (b < j) break; } if (b > 1) result++; } return result; } 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); } }