#include <bits/stdc++.h>   using namespace std;   namespace Flandre_Scarlet {   int I() {     char c = getchar();     int x = 0;     int f = 1;     while (c <  0  or c >  9 ) f = (c ==  - ) ? -1 : 1, c = getchar();     while (c >=  0  and c <=  9 )       x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();     return (x = (f == 1) ? x : -x);   }   template <typename T>   void Rd(T& arg) {     arg = I();   }   template <typename T, typename... Types>   void Rd(T& arg, Types&... args) {     arg = I();     Rd(args...);   }   void RA(int* p, int n) {     for (int i = 1; i <= n; ++i) *p = I(), ++p;   }   int n, a[200005];   void Input() {     n = I();     RA(a + 1, n);   }   int st[200005][18];   short lg[200005];   inline int gcd(int a, int b) {     while (b) {       a ^= b ^= a ^= b;       b %= a;     }     return a;   }   void SparseTable() {     memset(lg, -1, sizeof(lg));     for (int i = 0; i <= 17; ++i)       if ((1 << i) <= n) lg[1 << i] = i;     for (int i = 1; i <= n; ++i)       if (lg[i] == -1) lg[i] = lg[i - 1];     for (int i = 1; i <= n; ++i) st[i][0] = a[i];     for (int j = 1; j <= 17; ++j) {       for (int i = 1; i <= n; ++i)         st[i][j] = gcd(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]);     }   }   inline int Query(int l, int r) {     int k = lg[r - l + 1];     return gcd(st[l][k], st[r - (1 << k) + 1][k]);   }   unordered_map<int, long long> ans;   int GetNex(int l, int g) {     if (Query(l, n) == g) return n + 1;     int cur = l;     for (int i = 17; i >= 0; --i)       if (st[cur][i] % g == 0) cur = cur + (1 << i);     return cur;   }   void Soviet() {     SparseTable();     for (int i = n; i >= 1; --i) {       int g = a[i];       for (register int l = i, r; l <= n; l = r) {         r = GetNex(i, g);         ans[g] += r - l;         if (r == n + 1) break;         g = gcd(g, a[r]);       }     }     int q = I();     for (int i = 1; i <= q; ++i) printf( %lld n , ans[I()]);   }   void IsMyWife() {     Input();     Soviet();   }   }  // namespace Flandre_Scarlet   int main() {     Flandre_Scarlet::IsMyWife();     getchar();     return 0;   }   