Pagini recente » Cod sursa (job #2713372) | Cod sursa (job #1130043) | Cod sursa (job #2044949) | Cod sursa (job #796588) | Cod sursa (job #2003441)
#include <cstdio>
#include <vector>
#define LL long long
using namespace std;
vector<LL>v[8195];
const int DIM=50000;
int poz=DIM-1;
char buff[DIM];
void citeste(LL &nr)
{
nr=0;
while(!('0'<=buff[poz]&&buff[poz]<='9'))
{
if(++poz==DIM) fread(buff,1,DIM,stdin),poz=0;
}
while('0'<=buff[poz]&&buff[poz]<='9')
{
nr=nr*10 + buff[poz]-'0';
if(++poz==DIM) fread(buff,1,DIM,stdin),poz=0;
}
}
int main()
{
freopen ("dtcsu.in","r",stdin);
freopen ("dtcsu.out","w",stdout);
LL val;
for(int i=1;i<=276997;i++)
{
citeste(val);
if(val%2==1) v[val%8191].push_back(val);
}
LL q;
citeste(q);
int ct=0;
for(;q>0;--q)
{
citeste(val);
if(val>0) val=val/(val&(-val));
int ok=0,r=val&8191;
for(int j=0;j<v[r].size()&&ok==0;j++)
{
if(v[r][j]==val) ok=1;
}
ct+=ok;
}
printf("%d\n",ct);
}