#include <bits/stdc++.h>
using namespace std;
void Solve() {
  int64_t n;
  cin >> n;
  vector<int64_t> a(n), b(n);
  map<int64_t, int64_t> ma;
  for (int64_t i = 0; i < n; i++) {
    cin >> a[i];
    ma[a[i]]++;
  }
  int64_t count = 0;
  for (int64_t i = 0; i < n; i++) {
    bool flag = false;
    int64_t x = 1;
    while (x < 1e9) {
      x *= 2;
      if (x == a[i] || x == 2 * a[i]) {
        if (ma[a[i]] >= 2) {
          flag = true;
        }
      } else if (x > a[i]) {
        if (ma[x - a[i]]) {
          flag = true;
        }
      }
      if (flag) {
        break;
      }
    }
    if (!flag) {
      count++;
    }
  }
  cout << count << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  Solve();
  return 0;
}
