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. Int64 answer = 0; for (int i = 0; i < a.Length; i++) { Int64 move = a[i]; answer += move; while (move != 1) { for (int j = 2; j <= move; j++) { if (move % j == 0) { move /= j; break; } } answer += move; } } return answer; } 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); } }