#include using namespace std; long longestSequence(long a){ long re = a; if(re == 1)return 1; long sq = sqrt(a) + 1; long i ; for(i = 2; i < sq ; i += 1 + (1 & i)){ if(a % i == 0){ break; } } if(i >= sq){ i = a; } return re + longestSequence(a / i); } long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long re = 0; for(int i = 0;i < a.size(); i++){ re += longestSequence(a[i]); } return re; } 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; }