import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long buff[] = new long[64]; static long nummoves( long a ){ if( a == 1L ) return 1; long t = a; int bi = 0; for( int i = 0; i < pi; i++ ){ long p = P[i]; while( t%p == 0L ){ buff[bi++]=p; t/=p; } if( t == 1L ) break; } if( t != 1L ) buff[bi++] = t; long res = 1; for( int i = 0; i < bi; i++ ){ //System.out.println(buff[i]); res = res*buff[i]+1L; } return res; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long moves = 0; for( long ai : a ){ moves += nummoves(ai); } return moves; } static long P[]; static int pi; public static void main(String[] args) { P = new long[1000000]; pi = 0; P[pi++] = 2; P[pi++] = 3; boolean add4 = false; boolean ispri; int limit; for( int i = 5; i < 1000000; ){ ispri = true; limit = (int)Math.sqrt(i)+1; for( long p : P ){ if( p == 0 ) break; if( p > limit ) break; if( i%(int)p == 0 ){ ispri = false; break; } } if( ispri ){ P[pi++] = i; } i += ( add4 ? 4 : 2 ); add4 = !add4; } 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(); } }