#include #include #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) using namespace atcoder; using namespace std; typedef long long ll; ll op(ll a, ll b) { return gcd(a, b); } ll e() { return 0; } int main() { int n; cin >> n; vector a(n); rep(i, 0, n) cin >> a[i]; segtree st(a); ll ans = 0; int ri = 0; for (int i = 0; i < n; i++) { while (ri < n && st.prod(i, ri + 1) != 1) ri++; ans += n - ri; } cout << ans << endl; }