import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static boolean checkIfPrime(long number) { if (number == 1) { return false; } for (int i = 2; i < number; i++) { if (number % i == 0) { return false; } } return true; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long result = 0; for (long stick : a) { boolean divisible = true; long currentStick = stick; long numberOfPieces = 1; //System.out.println("*****"); while (divisible) { //System.out.println("current stick: "+ currentStick); //System.out.println("current number of pieces: "+ numberOfPieces); if (stick == 1) { result += 1; //System.out.println("result from stick of size 1: "+ result); break; } else if (checkIfPrime(currentStick)) { result += numberOfPieces; result += stick; //System.out.println("result from prime remainder: "+ result); break; } else if (currentStick % 2 == 1) { long primeDivider = -1; for (int i = 3; i < currentStick; i++) { if (currentStick % i == 0 && i > primeDivider && checkIfPrime(i)) { primeDivider = i; } } result += numberOfPieces; currentStick /= primeDivider; numberOfPieces = stick / currentStick; } else if (currentStick % 2 == 0) { long divider = 2; for (int i = 3; i < currentStick; i++) { if (currentStick % i == 0 && i > divider && checkIfPrime(i)) { //System.out.println("divider: " + i); divider = i; } } result += numberOfPieces; currentStick /= divider; numberOfPieces = stick / currentStick; } //System.out.println("result: "+ result); } } 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(); } long result = longestSequence(a); System.out.println(result); in.close(); } }