#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long MAX = 5100000; const long long INF = 1LL << 60; const long long mod = 1000000007LL; //const long long mod = 998244353LL; using namespace std; typedef unsigned long long ull; typedef long long ll; ll gcd(ll x, ll y) { ll r; if (x < y) { swap(x, y); } while (y > 0) { r = x % y; x = y; y = r; } return x; } int main() { /* cin.tie(nullptr); ios::sync_with_stdio(false); */ ll N; scanf("%lld", &N); vector A(N); for (ll i = 0; i < N; i++) scanf("%lld", &A[i]); vector> dp(N + 1); dp[0][0] = 1; for (ll i = 0; i < N; i++) { for (auto p : dp[i]) { dp[i + 1][gcd(p.first, A[i])] += p.second; dp[i + 1][p.first] += p.second; } } cout << dp[N][1] << endl; return 0; }