Pagini recente » Cod sursa (job #183997) | Cod sursa (job #100490) | Cod sursa (job #929023) | Cod sursa (job #2842304) | Cod sursa (job #2307665)
#include<bits/stdc++.h>
using namespace std;
unordered_set<long long> h;
long long x;
long long q,sol;
const int dim=1000000;
char buff[dim+5];
int pos=0;
void read(long long &n)
{
n=0;
long long sign=1LL;
while(buff[pos]<'0' || buff[pos]>'9')
{
if(buff[pos]=='-') sign=-1LL;
pos++;
if(pos==dim)
{
pos=0;
fread(buff,1,dim,stdin);
}
}
while(buff[pos]>='0' && buff[pos]<='9')
{
n=n*10LL+buff[pos]-'0';
pos++;
if(pos==dim)
{
pos=0;
fread(buff,1,dim,stdin);
}
}
n*=sign;
}
int main()
{
freopen("dtcsu.in","r",stdin);
freopen("dtcsu.out","w",stdout);
fread(buff,1,dim,stdin);
for(int i=1;i<=276997;i++)
{
// scanf("%lld",&x);
read(x);
h.insert(x/((x&(-x))));
}
read(q);
while(q--)
{
read(x);
if(x<=0) continue;
if(h.find(x/(x&(-x)))!=h.end()) sol+=1LL;
}
printf("%lld\n",sol);
return 0;
}