fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int MAXA = 3000000;
  4. const long long MOD = 123456789;
  5. int spf[MAXA + 1];
  6. void sieve() {
  7. for (int i = 1; i <= MAXA; i++) spf[i] = i;
  8. for (int i = 2; i * i <= MAXA; i++) {
  9. if (spf[i] == i) {
  10. for (int j = i * i; j <= MAXA; j += i) {
  11. if (spf[j] == j)
  12. spf[j] = i;
  13. }
  14. }
  15. }
  16. }
  17. int main() {
  18. ios::sync_with_stdio(false);
  19. cin.tie(nullptr);
  20. sieve();
  21. int n;
  22. cin >> n;
  23. unordered_map<int, long long> cnt;
  24. for (int i = 0; i < n; i++) {
  25. int x;
  26. cin >> x;
  27. while (x > 1) {
  28. int p = spf[x];
  29. cnt[p]++;
  30. x /= p;
  31. }
  32. }
  33. long long ans = 1;
  34. for (auto &it : cnt) {
  35. ans = ans * (it.second + 1) % MOD;
  36. }
  37. cout << ans;
  38. return 0;
  39. }
Success #stdin #stdout 0.04s 15412KB
stdin
4
2 2 3 4
stdout
10