#include using namespace std; long longestSequenceForOneStick(long a) { long currentLongest = sqrt(a); vector factors; factors.push_back(1); for(int i =2; i <= currentLongest; i++) { while((a%i)==0) { factors.push_back(i); a = a/i; currentLongest = sqrt(a); } } if(a > 1) factors.push_back(a); long total = 0; long multiplier = 1; for(int i = factors.size()-1; i >=0; i--) { total+=multiplier; multiplier = multiplier*factors[i]; } return total; } long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long total = 0; for(int i = 0; i < a.size(); i++) { total+=longestSequenceForOneStick(a[i]); } return total; } 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; }