import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] arr) { int n = arr.length; ArrayList[] l = new ArrayList[n]; long ans = 0; for(int i=0;i(); while(arr[i]%2 == 0) { arr[i] /= 2L; l[i].add(2L); } //debug(l[i]); for(long j=3; j <= Math.sqrt(arr[i]); j+=2) { while(arr[i] % j == 0) { arr[i] /= j; l[i].add(j); } } if(arr[i] > 2) l[i].add(arr[i]); Collections.sort(l[i]); Collections.reverse(l[i]); //debug(l[i]); long tmp = 1; ans++; for(long x:l[i]) { tmp *= x; ans += tmp; } } return ans; } 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(); } }