import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static List primefactors ; static long max; static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long result =0; for(int index = 0; index < a.length; index++){ primefactors = new ArrayList(); //for all elements in the sequence find their prime factorization and store in arraylist long number = a[index]; while(number%2 == 0){ primefactors.add(0, (long) 2); number/=2; } for(int i = 3; i*i <= number; i+=2){ while(number % i == 0){ primefactors.add(0, (long) i); number/=i; } } if(number > 2){ primefactors.add(0, (long)number); } //now calculate the result long temp = 1; number = a[index]; //result+=1; for(Long num : primefactors){ result+= temp; temp = temp*num; } result+=temp; } return result; } 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(); if(a[a_i] > max){ max = a[a_i]; } } long result = longestSequence(a); System.out.println(result); in.close(); } }