#include <bits/stdc++.h>
using namespace std;
int an[100005];
vector<int> VI[35];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> an[i];
  }
  for (int i = 0; i < 35; i++) VI[i].clear();
  for (int i = 0; i < 35; i++) {
    for (int j = 0; j < n; j++) {
      if ((1 << i) & an[j]) VI[i].push_back(j);
    }
  }
  int maxs = -1;
  int k;
  int t;
  for (int i = 0; i < 35; i++) {
    if (VI[i].size() == 0) continue;
    t = an[VI[i][0]];
    for (int j = 1; j < VI[i].size(); j++) t &= an[VI[i][j]];
    int cnt = 0;
    while ((t & 1) == 0) {
      cnt++;
      t >>= 1;
    }
    if (cnt > maxs) {
      maxs = cnt;
      k = i;
    }
  }
  if (maxs < 0)
    cout << "-1" << endl;
  else {
    t = VI[k].size();
    cout << t << endl;
    for (int i = 0; i < t; i++) {
      cout << an[VI[k][i]] << " ";
    }
    cout << endl;
  }
  return 0;
}
