#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll=long long; template using V = vector; template using P = pair; using vll = V; using vvll = V; #define rep(i, k, n) for (ll i=k; i<(ll)n; ++i) #define REP(i, n) rep(i, 0, n) #define ALL(v) v.begin(),v.end() template inline bool chmax(T& a, T b) {if (a inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;} const ll MOD = 1000000007; const ll HIGHINF = (ll)1e18; ll gcd(ll a, ll b) { if (b==0) return a; else return gcd(b, a%b); } int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vll a(n); REP(i, n) cin >> a[i]; V< map > dp(n); ll ans = 0; REP(i, n) { dp[i][a[i]]++; rep(j, i+1, n) { for (P e: dp[i]) { dp[j][gcd(e.first, a[j])] += e.second; } } ans += dp[i][1]; } cout << ans << '\n'; return 0; }