#include using namespace std; long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long sequence = 0; for (int elem = 0; elem < a.size(); elem++) { long stickLength = a[elem]; long double sqrtOfStickLength = sqrt((long double) stickLength); while (stickLength > 1) { sequence += stickLength; bool brokeOutOfLoop = false; bool isPrime = false; for (double d = 2; d <= sqrtOfStickLength; d++) { if (stickLength % (int)d == 0) { stickLength /= (int)d; brokeOutOfLoop = true; break; } } if (!brokeOutOfLoop) isPrime = true; if (isPrime) stickLength = 1; } sequence++; } return sequence; } int main() { int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } long result = longestSequence(a); cout << result << endl; return 0; }