#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 = 510000; const long long INF = 1LL << 60; const long long MOD = 1000000007LL; 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() { ll N; scanf("%lld", &N); vector a(N); for (ll i = 0; i < N; i++) scanf("%lld", &a[i]); vector> vm(N + 1); vm[0][0] = 1; for (ll i = 0; i < N; i++) { for (auto itr = vm[i].begin(); itr != vm[i].end(); itr++) { vm[i + 1][itr->first] += itr->second; vm[i + 1][gcd(a[i], itr->first)] += itr->second; } } printf("%lld\n", vm[N][1]); return 0; }