#include #include #include using namespace std; using ll = long long; template T gcd_(T a, T b) { while (b) { T tmp = b; b = a % b; a = tmp; } return a; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) cin >> a[i]; map dp; for (int x : a) { map new_dp = dp; for (auto& p : dp) { new_dp[gcd_(p.first, x)] += p.second; } new_dp[x]++; dp = move(new_dp); } cout << dp[1] << endl; return 0; }