Cod sursa(job #1868848)
Utilizator | Tudor Coman tudorcoman | Data | 5 februarie 2017 13:20:55 |
---|---|---|---|
Problema | Dtcsu | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.55 kb |
#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;
}