import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a) { int count = 0; for (int i = 0; i < a.length; i++) { count += countSteps(a[i], 1); } return count; } static long countSteps(long number, long sticks) { if(number <= 1) return 1 * sticks; int peaces = 2; if(number % 2 != 0) { for (int i = 2; i <= number; i++) { if (number % i == 0) { peaces = i; break; } } } else { for (int i = 2; i <= number; i++) { if (number % i == 0 && (number / i) % 2 == 0) { peaces = i; break; } if(peaces == 2 && number % i == 0) { peaces = i; } } } long size = number / peaces; return countSteps(size, (number / size) * sticks) + sticks; } 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(); } }