#include using namespace std; int main() { int64_t n; cin >> n; vector as(n); for (auto &&a : as) { cin >> a; } auto gcd = [](int64_t a, int64_t b) { while (b) { int64_t tmp = b; b = a % b; a = tmp; } return a; }; map mp; mp[as[0]] = 1; for (int64_t i = 1; i < n; i++) { map next(mp); next[as[i]]++; for (auto &&p : mp) { next[gcd(p.first, as[i])] += p.second; } swap(mp, next); } cout << mp[1] << endl; return 0; }