nguyenttuca
Rating
-
Bài tập
12
Điểm
5155
Rating
-
Điểm
6752
Giới thiệu
include<bits/stdc++.h>
define ll long long
using namespace std;
int n, cnt = 0;
ll a;
vector<ll> h;
bool snt(ll n){
for(int i = 2; i <= sqrt(n); i++) if(n % i == 0) return false;
return true;
}
bool shh(){
ll x, y;
for(int i = 2; i < 35; i++){
if(snt(i) == true){
x = pow(2, i) - 1;
if(snt(x) == true){
y = pow(2, i - 1);
h.push_back(x*y);
}
}
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n;
shh();
for(int i = 0; i < n; i++){
cin>>a;
if(binary_search(h.begin(), h.end(), a)) cnt++;
}
cout<<cnt;
return 0;
}