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. return a.ToList().Select(GetSequence).Sum(); } static long GetSequence(long a) { var temp = a; var delimiters = new List(); var i = 2L; while (i <= temp) { if (temp % i == 0) { delimiters.Add(i); temp /= i; } else { i++; } } var movesCount = 0L; var stickCount = 1L; delimiters.OrderByDescending(x =>x).ToList().ForEach(x => { movesCount += stickCount; stickCount *= x; }); return movesCount + a; } 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); } }