import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.util.stream.*; public class Solution { public static boolean isPrime(long number) { return !LongStream.rangeClosed(2, number/2).anyMatch(i -> number%i == 0); } static long longestSequence(long[] a) { long sum_moves = 0; for (int i = 0; i < a.length; i++) { if (isPrime(a[i])) { System.out.println(a[i] + " is PRIME"); sum_moves += (a[i] == 1 ? a[i] : a[i] + 1L); System.out.println(sum_moves); } else { System.out.println(a[i] + " is not PRIME"); sum_moves += breakOrEat(a[i], 1); } } return sum_moves; } /* 24 -> (1 move) 8, 8, 8 -> (3 moves) 4, 4, 4, 4, 4, 4 -> (6 moves) -> 2 2 2 2 2 2 2 2 2 2 2 2 -> 12 moves -> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -> (eat all, 24 moves) 24 + 12 + 6 + 3 + 1 = 46*/ static long breakOrEat(long substick, long moves) { //System.out.println("Trying to breakOrEat " + substick + " CURRENT: " + moves); if (substick%2 == 0) { if (substick/2 == 1) { return 2; } else { for (int j = 0; j < 2*substick/substick; j++){ moves++; moves += breakOrEat(substick/2, moves); } } } else { return 3; } return moves; } 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(); } }