#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int a[N];
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<int> nrs;
  for (int i = 0; i < n; ++i) nrs.push_back(a[i]);
  for (int i = 1; i < 32; ++i) {
    vector<int> counts(32, 0);
    vector<int> cur;
    for (int j = 0; j < n; ++j) {
      if (not(a[j] & (1 << i))) continue;
      cur.push_back(a[j]);
      for (int k = 0; k < 32; ++k) {
        if (a[j] & (1 << k)) ++counts[k];
      }
    }
    if (cur.empty()) continue;
    bool ok = true;
    for (int j = 0; j < i; ++j) {
      ok &= counts[j] < counts[i];
    }
    if (ok) nrs = cur;
  }
  cout << nrs.size() << '\n';
  for (int i = 0; i < (int)nrs.size(); ++i) {
    if (i > 0) cout << ' ';
    cout << nrs[i];
  }
  cout << '\n';
}
