using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static ulong longestSequence(ulong[] a) { ulong sum = 0; foreach (var x in a) sum += longestSeq(x); return sum; } static ulong longestSeq(ulong x) { if (x == 1) return 1; ulong rest = x; double sqrt; ulong sum = 1; bool divided = true; while (divided) { sum += rest; sqrt = Math.Sqrt(rest); divided = false; for (ulong i = 2; i <= sqrt; i++) { if (rest % i == 0) { rest = rest / i; divided = true; break; } } } return sum; } static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] a_temp = Console.ReadLine().Split(' '); ulong[] a = Array.ConvertAll(a_temp, UInt64.Parse); ulong result = longestSequence(a); Console.WriteLine(result); } }