Pagini recente » Cod sursa (job #795757) | Cod sursa (job #861549) | Cod sursa (job #1437166) | Cod sursa (job #1377097) | Cod sursa (job #1065620)
#include<algorithm>
#include<unordered_set>
using namespace std;
struct MyHash
{
private: vector<long long> H[6613];
public:
inline void insert(long long x) {H[x%6613].push_back(x);}
inline int count(long long x)
{
int h=x%6613;
for(vector<long long>::iterator it=H[h].begin();it!=H[h].end();it++)
if(*it==x)
return 1;
return 0;
}
}S;
int main()
{
freopen("dtcsu.in","r",stdin);
freopen("dtcsu.out","w",stdout);
int N=0,Q;long long x;
for(int i=1;i<=276997;i++)
{
scanf("%lld",&x);
if(x&1)
S.insert(x);
}
scanf("%d",&Q);
for(int i=1;i<=Q;i++)
{
scanf("%lld",&x);
if(x && S.count(x/(x&(-x))))
N++;
}
printf("%d\n",N);
return 0;
}