#include <bits/stdc++.h>
template <typename Arg1>
void ZZ(const char* name, Arg1&& arg1) {
  std::cout << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cout.write(names, comma - names) << " = " << arg1;
  ZZ(comma, args...);
}
using namespace std;
long long n, m, k, q;
map<long long, long long> mp;
bool exists(long long x) {
  long long goal = 2;
  for (long long i = 0; i < 33; i++) {
    if (mp.find(goal - x) != mp.end() && (goal - x != x || mp[x] > 1)) {
      return true;
    }
    goal *= 2;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long t;
    cin >> t;
    mp[t]++;
  }
  long long ans = n;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    if (exists(it->first)) ans -= it->second;
  }
  cout << ans << endl;
  return 0;
}
