#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
map<int, long long> dp;
map<int, int> mp[N];
int a[N], n;
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  mp[0][a[0]] = 1;
  dp[a[0]] = 1;
  for (int i = 1; i < n; i++) {
    mp[i][a[i]] = 1;
    for (auto it : mp[i - 1]) mp[i][gcd(it.first, a[i])] += it.second;
    for (auto it : mp[i]) dp[it.first] += it.second;
  }
  int q;
  cin >> q;
  vector<long long> ans;
  for (int i = 0; i < q; i++) {
    int x;
    cin >> x;
    ans.push_back(dp[x]);
  }
  for (auto x : ans) cout << x << "\n";
  cout << flush;
  return 0;
}
