Cod sursa(job #1868846)
| Utilizator | Data | 5 februarie 2017 13:19:55 | |
|---|---|---|---|
| Problema | Dtcsu | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
unordered_set<ll> Hash;
void reduce(ll &x) {
while(~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;
}
