#pragma GCC optimize ("Ofast") #include using namespace std; inline void rd(int &x){ int k; int m=0; x=0; for(;;){ k = getchar_unlocked(); if(k=='-'){ m=1; break; } if('0'<=k&&k<='9'){ x=k-'0'; break; } } for(;;){ k = getchar_unlocked(); if(k<'0'||k>'9'){ break; } x=x*10+k-'0'; } if(m){ x=-x; } } inline int rd_int(void){ int x; rd(x); return x; } inline void wt_L(char a){ putchar_unlocked(a); } inline void wt_L(long long x){ int s=0; int m=0; char f[20]; if(x<0){ m=1; x=-x; } while(x){ f[s++]=x%10; x/=10; } if(!s){ f[s++]=0; } if(m){ putchar_unlocked('-'); } while(s--){ putchar_unlocked(f[s]+'0'); } } template inline T GCD_L(T a,T b){ T r; while(a){ r=b; b=a; a=r%a; } return b; } int A; int main(){ int Lj4PdHRW; long long res; map mp; mp[0] = 1; int KL2GvlyY = rd_int(); for(Lj4PdHRW=(0);Lj4PdHRW<(KL2GvlyY);Lj4PdHRW++){ map nx; rd(A); for(pair p : mp){ nx[GCD_L(p.first, A)] += p.second; nx[p.first] += p.second; } mp = nx; } res = mp[1]; wt_L(res); wt_L('\n'); return 0; } // cLay varsion 20191012-1 // --- original code --- // int A; // { // ll res; // map mp; // mp[0] = 1; // REP(rd_int()){ // map nx; // rd(A); // for(pair p : mp){ // nx[gcd(p.first, A)] += p.second; // nx[p.first] += p.second; // } // mp = nx; // } // res = mp[1]; // wt(res); // }