#include #include #include #include #include template std::vector divisors(T n) { std::vector ret; for (T p = 1; p * p <= n; ++p) { if (n % p != 0) continue; ret.push_back(p); if (n / p == p) continue; ret.push_back(n / p); } return ret; } template std::map compress(std::vector& v) { std::sort(v.begin(), v.end()); v.erase(std::unique(v.begin(), v.end()), v.end()); std::map rev; for (int i = 0; i < (int)v.size(); ++i) rev[v[i]] = i; return rev; } using lint = long long; void solve() { int n; std::cin >> n; std::vector xs(n); std::vector ps{0}; for (auto& x : xs) { std::cin >> x; for (auto p : divisors(x)) { ps.push_back(p); } } auto revp = compress(ps); int m = ps.size(); std::vector dp(m, 0); dp[0] = 1; auto ndp = dp; for (auto x : xs) { for (int i = 0; i < m; ++i) { int j = revp[std::gcd(x, ps[i])]; ndp[j] += dp[i]; } dp = ndp; } std::cout << dp[1] << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }