#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

constexpr int N = 512345, M = 20;
ll a[N][M];

int main(){
	int n; scanf("%d", &n);
	REP(i, n) scanf("%lld", a[i]);
	FOR(i, n, N) a[i][0] = 1;
	FOR(i, 1, M){
		REP(j, n){
			int k = j + (1<<(i-1));
			if(k >= N) continue;
			a[j][i] = gcd(a[j][i-1], a[k][i-1]);
		}
	}
	DEBUG("constructed\n");
	ll ans = 0;
	REP(i, n){
		ll z = 0;
		int j = i;
		for(int k = M-1; k >= 0; k--){
			int jj = j + (1<<k);
			if(jj > n) continue;
			ll zz = gcd(z, a[j][k]);
			DEBUG("  gcd[%d, %d) = %lld -> %lld\n", j, jj, a[j][k], z);
			if(zz > 1) {
				j = jj;
				z = zz;
			}
		}
		DEBUG("[%d, %d)\n", i, j);
		ans += n-j;
	}
	printf("%lld\n", ans);
}