#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define fi first #define se second template inline bool chmax(A &a, B b) { if (a inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } using ll = long long; using pii = pair; constexpr ll INF = 1ll<<30; constexpr ll longINF = 1ll<<60; constexpr ll MOD = 1000000007; constexpr bool debug = 0; //---------------------------------// vector findDivisor(ll n) { vector divisor; for (ll i = 1; i * i <= n; i++) { if (n % i == 0) { divisor.push_back(i); if (i * i != n) divisor.push_back(n / i); } } sort(ALL(divisor)); return divisor; } ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } int N; int A[50]; ll dp[51][25601]; int main() { cin >> N; REP(i, N) cin >> A[i]; map mm; vector rev; REP(i, N) { vector v = findDivisor(A[i]); for (ll cur : v) if (mm.find(cur) == mm.end()) { int sz = mm.size(); mm[cur] = sz; rev.push_back(cur); } } REP(i, N) { REP(j, rev.size()) if (dp[i][j]) { dp[i + 1][mm[gcd(A[i], rev[j])]] += dp[i][j]; dp[i + 1][j] += dp[i][j]; } dp[i + 1][mm[A[i]]]++; } cout << dp[N][mm[1]] << endl; return 0; }