#include #include using namespace std; using namespace atcoder; using S = long long; S op(S x, S y){ if(x > y) swap(x, y); if(x == 0) return y; return op(y % x, x); } S e(){ return 0; } bool f(S x){ return x != 1; } void solve(){ int n; cin >> n; vector A(n); for(int i = 0; i < n; i++) cin >> A[i]; segtree seg(A); long long ans = 0; int l = 0; for(int r = 1; r <= n; r++){ while(l < r){ auto x = seg.prod(l, r); if(x != 1) break; l++; } ans += l; } cout << ans << "\n"; } int main(){ cin.tie(0)->sync_with_stdio(0); int t; t = 1; //cin >> t; while(t--) solve(); }