using System; using System.Collections.Generic; using System.Linq; using System.Text; class Solution { static Dictionary map = new Dictionary(); static List primes = new List(); static void Main(String[] args) { #if LOCAL Console.SetIn(new System.IO.StreamReader("input")); #endif primes.Add(2); for (int i = 3; i < 1000000; i += 2) { if (isprime(i)) primes.Add(i); } int n = int.Parse(Console.ReadLine()); long[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); Console.WriteLine(arr.Sum(x => getcount(x))); } static long getcount(long length) { var i = length; if (!map.ContainsKey(length)) { var p = pdiv(length); long max = length == 1 ? 1 : length + 1; long j = 1; foreach (var item in p) { j *= item; i /= item; if (j != length && i != length) { var a = 1 + j * getcount(i); var b = 1 + i * getcount(j); max = Math.Max(max, Math.Max(a, b)); } } map[length] = max; } return map[length]; } private static List pdiv(long length) { var en = primes.GetEnumerator(); en.MoveNext(); var t = en.Current; List l = new List(); while (length > 1) { while (length % t == 0) { l.Add(t); length /= t; } if (!en.MoveNext()) { l.Add(length); return l; } t = en.Current; } return l; } static bool isprime(long n) { var t = (int)Math.Sqrt(n); for (int i = 3; i < t; i += 2) { if (n % i == 0) return false; } return true; } }