import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a) { long sum = 0; for (long stick : a) { /* if (a == 1) { sum += 1; return; // } else if (isPrime(stick)) { // sum += stick+1; } else */ { long sticks = stick; long length = 1; long moves = 0; //break while(length < stick ) { long divisor = 2; while (stick != length) { System.err.println(divisor + " "+ length + " " + (length*divisor)); if (length * divisor > stick) { moves = 1; length = stick; sticks = stick; break; } if (length * divisor == stick) { System.err.println("valid1"); moves += sticks; sticks /= divisor; length *= divisor; System.err.println("s" +sticks + " "+ length+ " "+ moves); break; } else if (length * divisor < stick && length * divisor *2 < stick) { System.err.println("valid2"); moves += sticks; sticks /= divisor; length *= divisor; System.err.println("s" +sticks + " "+ length+ " "+ moves); break; } else if (length * divisor < stick && length * (divisor+1) > stick) { System.err.println("valid3"); moves += sticks; sticks /= divisor; length *= divisor; System.err.println("s" +sticks + " "+ length+ " "+ moves); break; } //if (divisor < length /2) divisor++; //else divisor=length; } } //eat moves += sticks; sum += moves; System.err.println("stick "+ stick + " moves "+ moves); } } // Return the length of the longest possible sequence of moves. 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(); } }