#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); vector> dp(n + 1); for(auto &&v:a)cin >> v; dp[0][0] = 1; ll ans = 0; for(int i = 0; i <= n; i++){ for(auto &&p:dp[i]){ if(p.first == 1)ans += p.second; for(int j = i + 1; j <= n; j++){ dp[j][__gcd(a[j - 1], p.first)] += p.second; } } } cout << ans << '\n'; }