Pagini recente » Cod sursa (job #1299825) | Cod sursa (job #450979) | Cod sursa (job #2570814) | Cod sursa (job #2841620) | Cod sursa (job #1915528)
#include<bits/stdc++.h>
#define dim 100000
using namespace std;
long long n,x,sol,q;
int poz=0;
char buff[dim+5];
set<long long> hash;
void read(long long &nr)
{
nr=0LL;
while(buff[poz]<'0' || buff[poz]>'9')
{
poz++;
if(poz==dim)
{
poz=0;
fread(buff,1,dim,stdin);
}
}
while(buff[poz]>='0' && buff[poz]<='9')
{
nr=nr*10+(buff[poz]-'0');
poz++;
if(poz==dim)
{
poz=0;
fread(buff,1,dim,stdin);
}
}
}
int main()
{
freopen("dtcsu.in","r",stdin);
freopen("dtcsu.out","w",stdout);
fread(buff,1,dim,stdin);
for(int i=1;i<=276997;i++)
{
read(x);
while(x && !(x&1LL)) x>>=1LL;
hash.insert(x);
}
read(q);
for(int i=1;i<=q;i++)
{
read(x);
while(x && !(x&1LL)) x>>=1LL;
if(hash.find(x)!=hash.end()) sol++;
}
printf("%lld\n",sol);
return 0;
}