#include using namespace std; //Greatest Common Divisor long long GCD(long long a, long long b) { return ((b == 0) ? a : GCD(b, a % b)); } int main() { int N; cin >> N; assert(1<= N && N <= 50); vector A(N); for(int i = 0; i < N; ++i) cin >> A[i]; for(int i = 0; i < N; ++i) assert(1 <= A[i] && A[i] <= 100000000); // dp[i][j] := (最後にA[i]を使ってgcdがjになるような場合の数) vector> dp(N); long long ans = 0; //dp O(NN*d(A)*(log(A)+log(d(A))) d(A) Aの約数の個数 for(int i = 0; i < N; ++i) { dp[i][A[i]]++; for(int j = i+1; j < N; ++j) { for(auto e:dp[i]){ dp[j][GCD(e.first,A[j])] += e.second; } } ans += dp[i][1]; } cout << ans << endl; return 0; }