#include using namespace std; typedef long long ll; #define inf 10e17 #define rep(i,n) for(long long i=0; i()) #define debug(x) std::cerr << (x) << std::endl; #define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; } template inline void chmax(T &ans, T t) { if (t > ans) ans = t;} template inline void chmin(T &ans, T t) { if (t < ans) ans = t;} // 最大公約数を求める(ユークリッドの互除法). long long gcd (long long x, long long y) { if (y > x) swap(x,y); if (y == 0) return x; return gcd(x%y,y); } // 素因数分解 /* * [2]-> 5, [3] -> 5のとき N = 2^5 * 3^5 */ template map factorize(T x) { map res; for (long long i = 2; i * i <= x; ++i) { while (x % i == 0) { x /= i; res[i] += 1; } } if (x != 1) res[x]++; return res; } int main() { ll n; cin >> n; vector a(n); vector> fact(n); repr(i, n, 0) { cin >> a[i]; fact[i] = factorize(a[i]); } int head = 0, tail = 0; ll total = a[0], ans = 0; map mp; while (head != n) { auto f = factorize(a[head]); // a[head]の素因数 if (a[head] == 1) ans += 1; for (auto num : f) { mp[num.first] += 1; } for (auto& num : mp) { if (num.second > 1) { ll dis = head - tail; ans += dis * (dis - 1) / 2; for (;; tail++) { for (auto it : fact[tail]) { mp[it.first] -= 1; } if (num.second == 1) break; } } } head++; } ans += (head - tail) * (head - tail - 1) / 2; cout << ans << endl; }