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 ans = 0; foreach (long x in a) { ans += f(x); } return ans; } static long f(long x) { if (x == 1) return 1; long max = 1; long s = (long)Math.Sqrt(x); for (int i = 2; i <= s; i++) { if (x % i == 0) { //max = Math.Max(f(i), max); max = Math.Max(f(x / i), max); break; } } return x + max; } 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); } }