#include <bits/stdc++.h>
using namespace std;
long n, p, temp, ans;
vector<long> vec[100], ovr;
vector<long> av;
long gdeg(long x) {
  long r = 0;
  while (x) {
    r++;
    x /= 2;
  }
  return r - 1;
}
long ar[200000];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  ans = -1;
  for (int i = 30; i + 1; --i) {
    temp = (1ll << 31) - 1;
    for (int ii = 1; ii <= n; ii++)
      if (ar[ii] & (1 << i)) temp &= ar[ii];
    if (temp % (1 << i) == 0 && ans == -1) {
      ans = max(ans, i + ans - ans);
      av.clear();
      for (int ii = 1; ii <= n; ii++)
        if (ar[ii] & (1 << i)) av.push_back(ar[ii]);
    }
  }
  if (ans >= 0) {
    cout << av.size() << endl;
    for (int i = 0; i < av.size(); i++) {
      if (i) cout << " ";
      cout << av[i];
    }
    cout << endl;
  } else {
    cout << n << endl;
    for (int i = 0; i < ovr.size(); i++) {
      if (i) cout << " ";
      cout << ovr[i];
    }
    cout << endl;
  }
  cin.get();
  cin.get();
  return 0;
}
