Pagini recente » Cod sursa (job #2551903) | Cod sursa (job #1604709) | Cod sursa (job #1868364) | Cod sursa (job #512862) | Cod sursa (job #1566059)
#include <bits/stdc++.h>
using namespace std;
const int NMax = 276997;
const int Size = 20;
const int BMax = 1e5;
const int v[] = {2, 3, 5, 7, 11};
char S[Size];
int pos = BMax - 1;
char Buffer[BMax];
inline void Read(long long int &x){
while(!isdigit(Buffer[pos])){
if(++pos == BMax){
fgets(Buffer, BMax, stdin);
pos = 0;
}
}
x = 0;
while(isdigit(Buffer[pos])){
x = x * 10 + (Buffer[pos] - '0');
if(++pos == BMax){
fgets(Buffer, BMax, stdin);
pos = 0;
}
}
}
int main(){
freopen("dtcsu.in", "r", stdin);
freopen("dtcsu.out", "w", stdout);
long long int q, ans, x;
for(int i = 1; i <= NMax; i++) fgets(S, Size, stdin);
Read(q);
ans = 0;
while(q--){
Read(x);
for(int i = 0; i < 5; i++){
while(x % v[i] == 0) x /= v[i];
}
if(x == 1) ans++;
}
printf("%lld", ans);
return 0;
}