#include #include #include #include #include inline static std::vector get_primes(long long n) { std::vector r; int end = int(std::sqrt(n)) + 2; for (int k = 3; k < end; k += 2) { bool prime = true; for (auto x : r) { if (k % x == 0) { prime = false; break; } } if (prime) r.push_back(k); } return r; } inline static long long count_moves_2(long long n, const std::vector& primes) { long long r = 1; while ((n & 1) == 0) { r <<= 1; ++r; n >>= 1; } int end = int(std::sqrt(n)) + 1; for (auto x : primes) { while ((n % x) == 0) { r *= x; ++r; n /= x; } if (n == 1 || x > end) break; } if (n != 1) { r *= n; ++r; } return r; } inline static long long count_moves_3(long long n) { long long r = 1; while ((n & 1) == 0) { r <<= 1; ++r; n >>= 1; } int end = int(std::sqrt(n)) + 1; for (int x = 3; x < end; x += 2) { while ((n % x) == 0) { r *= x; ++r; n /= x; } if (n == 1 || x > end) break; } if (n != 1) { r *= n; ++r; } return r; } int main() { std::ios::sync_with_stdio(false); size_t n; std::cin >> n; long long max_a = 0; std::vector a(n); for (auto &x : a) { std::cin >> x; max_a = std::max(max_a,x); } //std::vector primes = get_primes(max_a); long long total = 0; for (auto x : a) { if (x == 1) { ++total; } else { total += count_moves_3(x); } } std::cout << total << std::endl; return 0; }