Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- ll n;
- cin >> n;
- vector<ll>v(n);
- multiset<ll>s;
- for (ll i=0; i<n; i++) {
- cin >> v[i];
- s.insert(v[i]);
- }
- ll ans=0;
- for (ll j=0; j<n; j++) {
- ll f=0;
- s.erase(s.find(v[j]));
- for (ll i=2; i<1e9+1; i*=2) {
- if (s.find(i-v[j])!=s.end()) {
- f++; break;
- }
- }
- if (!f) ans++;
- s.insert(v[j]);
- }
- cout << ans << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment