import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long numberOfMoves(long a) { if (a == 1L) { return 1L; } //System.out.println("log: numberOfMoves(" + a + ")"); long maxNumber = a + 1; for (long i = 2; i <= a / 2; i++) { if (a % i == 0) { long number = 1 + i * numberOfMoves(a / i); if (number > maxNumber) { maxNumber = number; } } } return maxNumber; } static long longestSequence(long[] a) { long sum = 0L; for (int i = 0; i < a.length; i++) { sum += numberOfMoves(a[i]); } return sum; // Return the length of the longest possible sequence of moves. } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); } long result = longestSequence(a); System.out.println(result); in.close(); } }