import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long check(long n) { Vector v = new Vector<>(); // boolean we=true; for (int i=1; i<=Math.sqrt(n); i++) { if (n%i==0) { if (n/i == i) {}// check if divisors are equal{} // System.out.printf("%d ", i); else { // System.out.printf("%d ", i); // push the second divisor in the vector v.add(n/i); } } } //System.out.println(v.size()); if(v.size()<=1) { return 1; }else{ return v.get(1);} } static long count(long n) { boolean res=true; if(n<=1) { return 1; } long y=0; for(long i=n/2;i>1;i--) { if(n%i==0) { y=i; res=false; return i; } } if(res==true) { return 1; } return y; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long sum=0; for(int i=0;i1) { u=check(u); sum=sum+u; } } return sum; } 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(); } }