Pagini recente » Cod sursa (job #1542522) | Cod sursa (job #350373) | Cod sursa (job #2151662) | Cod sursa (job #1989107) | Cod sursa (job #2300551)
#include <bits/stdc++.h>
using namespace std;
ifstream in("dtcsu.in");
ofstream out("dtcsu.out");
typedef unsigned long long int ull;
unordered_set< ull > uSet;
int main() {
ios::sync_with_stdio(false); in.tie(0); out.tie(0);
for (int i = 1; i <= 276997; ++i) {
ull nr; in >> nr;
while (nr && (nr & 1) != 0) {
nr >>= 1;
}
uSet.insert(nr);
}
ull ans = 0;
int Q; in >> Q;
while (Q--) {
ull n; in >> n;
while (n && (n & 1) != 0) {
n >>= 1;
}
if (uSet.find(n) != uSet.end()) {
++ans;
}
}
out << ans << "\n";
in.close(); out.close();
return 0;
}