#include using namespace std; long smallest_divisor(long input) { if(input%2==0) return 2; long end = std::sqrt(input); for(long i=3; i <= end; i+=2) if(input%i==0) return i; return input; } long longestSequence(vector a) { long result = 0; for(long elem : a) { result+=elem; while(elem > 1) { elem /= smallest_divisor(elem); result+=elem; } } return result; } 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; }