#include #include #include #include #include #include #include using namespace std; using ll = long long; constexpr ll MOD = 1e9 + 7; constexpr int INF = 1 << 30; ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); } int main() { cin.tie(0); ios_base::sync_with_stdio(false); int N; cin >> N; vector a(N); for(int i = 0; i < N; ++i) cin >> a[i]; unordered_map dp; for(int i = 0; i < N; ++i) { unordered_map tmp; for(auto itr = dp.begin(); itr != dp.end(); ++itr) { if(itr->first == 0) { tmp[a[i]] += itr->second; } else { tmp[gcd(itr->first, a[i])] += itr->second; } tmp[itr->first] += itr->second; } swap(dp, tmp); if (!dp[a[i]]) { dp[a[i]] = 1; } if (!dp[0]) { dp[0] = 1; } } cout << dp[1] << '\n'; return 0; }