Pagini recente » Cod sursa (job #836003) | Cod sursa (job #2444808) | Cod sursa (job #2767174) | Cod sursa (job #1332565) | Cod sursa (job #1265483)
#include <cstdio>
#include <algorithm>
#define buflen 10000
using namespace std;
int answer;
int n;
long long shmen[50005];
int shmenPos;
char buf[buflen];
int bufpos = buflen;
char getch()
{
if (bufpos >= buflen)
{
fread(buf,1,buflen,stdin);
bufpos = 0;
}
return buf[bufpos++];
}
inline bool isNumber(char a)
{
return '0' <= a && a <= '9';
}
long long BISRead()
{
long long aux = 0;
char ct = getch();
while (!isNumber(ct)) ct = getch();
while (isNumber(ct))
{
aux = 10 * aux + ct - '0';
ct = getch();
}
return aux;
}
int main()
{
freopen("dtcsu.in","r",stdin);
freopen("dtcsu.out","w",stdout);
for (int i=1;i <= 276997;i++)
{
int aux = BISRead();
if (!(aux&1)) shmen[shmenPos++] = aux;
}
sort(shmen,shmen+shmenPos);
n = BISRead();
for (int i=1;i<=n;i++)
{
int ct = BISRead();
while (!(ct&1)) ct >>= 1;
long long* p = lower_bound(shmen,shmen+shmenPos,ct);
if (ct == *p) answer++;
}
printf("%d\n",answer);
return 0;
}