#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
int cnt[100005] = {0};
for(int i = 0; i < n; i++) {
cin >> a[i];
cnt[a[i]]++;
}
int sum[100005] = {0};
for(int i = 2; i <= 100005; i++) {
for(int j = i; j <= 100005; j += i) {
sum[i] += cnt[j];
}
}
int q;
cin >> q;
while(q--) {
int a;
cin >> a;
cout << sum[a] << endl;
}
}