using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long result=0; foreach(long n in a){ result += calculate(n); } return result; } static long calculate(long n){ long result = n; if(n==1) return result; for (var i = 2; i <= n; i++) { if(Math.Sqrt(n)%1 == 0) { n = (long)Math.Sqrt(n); result += n;} while(n%i == 0 && n>i){ n = n/i; result += n; } if(isprime(n)) break; } return ++result; } static bool isprime(long number){ if (number < 2) return false; if (number % 2 == 0) return (number == 2); int root = (int)Math.Sqrt((double)number); for (int i = 3; i <= root; i += 2) { if (number % i == 0) return false; } return true; } 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); } }