#include #include #include #include #include #include #include using namespace std; const unsigned int N_MAX = 100000; int main() { int l, m, n, q; int input; cin >> l >> m >> n; bitset a, b; for (int i = 0; i < l; i++) { cin >> input; a[input] = 1; } for (int i = 0; i < m; i++) { cin >> input; b[input] = 1; } cin >> q; vector ans(q, 0); for (int i = 0; i < q; i++) { ans[i] = (a & b).count(); a >>= 1; } for (int i = 0; i < q; i++) { cout << ans[i] << endl; } return 0; }