Pagini recente » Cod sursa (job #1760340) | Cod sursa (job #356879) | Cod sursa (job #793707) | Cod sursa (job #2386148) | Cod sursa (job #1868848)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
unordered_set<ll> Hash;
void reduce(ll &x) {
while(x > 0 and (~x & 1))
x >>= 1;
}
int main() {
freopen("dtcsu.in", "r", stdin);
freopen("dtcsu.out", "w", stdout);
ll x;
for(int i = 1; i <= 276997; ++ i) {
scanf("%lld", &x);
reduce(x);
Hash.insert(x);
}
int Q;
int ans = 0;
for(scanf("%d", &Q); Q; -- Q) {
scanf("%lld", &x);
reduce(x);
ans += (Hash.find(x) != Hash.end());
}
printf("%d\n", ans);
return 0;
}