#include <bits/stdc++.h>
using namespace std;
int cnt(int x) {
  int c = 0;
  while (x) {
    x &= (x - 1);
    c++;
  }
  return c;
}
int main() {
  int n;
  cin >> n;
  vector<long long> vv;
  vector<int> v;
  for (int i = 0; i < 32; i++) {
    vv.push_back(pow(2, i));
  }
  map<long long, int> mp;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
    mp[x]++;
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < vv.size(); j++) {
      if (vv[j] - v[i] > 0 && mp[(vv[j] - v[i])] > 0) {
        cnt++;
        if ((vv[j] - v[i]) == v[i] && mp[(vv[j] - v[i])] == 1)
          cnt--;
        else
          break;
      }
    }
  }
  n -= cnt;
  cout << n << endl;
  return 0;
}
