Pagini recente » Cod sursa (job #445446) | Cod sursa (job #3276406) | Cod sursa (job #1689378) | Cod sursa (job #576995) | Cod sursa (job #1541375)
#include <bits/stdc++.h>
using namespace std;
const int D[] = {3, 5, 7, 11};
const unsigned long long MAX_V[] = { 333333333333333333ULL, 200000000000000000ULL, 142857142857142857ULL, 90909090909090909ULL };
unsigned long long curr;
int pos;
unordered_set <unsigned long long> H;
inline char getChar() {
static char buff[1048576];
static int pos = 1048576;
if (pos == 1048576) {
fread_unlocked(buff, 1, 1048576, stdin);
pos = 0;
}
return buff[pos++];
}
template <class T>
inline void readVar(T &q) {
char c;
do {
c = getChar();
} while (!isdigit(c));
q = 0;
do {
q = (q << 1) + (q << 3) + (c - '0');
c = getChar();
} while (isdigit(c));
}
void bkt() {
H.insert(curr);
for (int i = pos; i < 4; i++) {
if (curr <= MAX_V[i]) {
curr = curr * D[i];
pos = i;
bkt();
curr /= D[i];
}
}
}
int main(void) {
freopen("dtcsu.in", "r", stdin);
freopen("dtcsu.out", "w", stdout);
int q, ans;
char c;
unsigned long long x;
curr = 1ULL;
pos = 0;
bkt();
int i = 0;
do {
do {
c = getChar();
} while (!isdigit(c));
do {
c = getChar();
} while (isdigit(c));
i++;
} while (i < 276997);
readVar(q);
ans = 0;
while (q--) {
readVar(x);
if (x != 0) {
ans += H.find(x / (x & -x)) != H.end();
}
}
printf("%d\n", ans);
fclose(stdin);
fclose(stdout);
return 0;
}