Pagini recente » Cod sursa (job #757708) | Cod sursa (job #898233) | Cod sursa (job #2744050) | Cod sursa (job #965494) | Cod sursa (job #1915477)
#include<bits/stdc++.h>
#define dim 100000
using namespace std;
long long n,x,sol,q;
int poz=0;
char buff[dim+5];
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*10LL+1LL*(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);
}
read(q);
for(int i=1;i<=q;i++)
{
read(x);
while(x>1LL && !(x%2LL)) x>>=1LL;
while(x>1LL && !(x%3LL)) x/=3LL;
while(x>1LL && !(x%5LL)) x/=5LL;
while(x>1LL && !(x%7LL)) x/=7LL;
while(x>1LL && !(x%11LL)) x/=11LL;
if(x==1LL) sol=sol+1LL;
}
printf("%lld\n",sol);
return 0;
}