#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d\n", &n);
  vector<vector<int> > v(34, vector<int>(0));
  for (int i = 0, j; i < n; i++) {
    scanf("%d", &j);
    for (int k = 0; k < 32; k++) {
      if (j & (1 << k)) v[k + 1].push_back(j);
    }
  }
  vector<vector<int> > vv(0);
  for (int i = 31; i > 0; i--) {
    if ((int)(v[i].size())) {
      int k = v[i][0];
      for (int j = 1; j < (int)(v[i].size()); j++) k &= v[i][j];
      for (int j = 31; j >= 0; j--) {
        if (k % (1 << j) == 0) {
          vector<int> cc(3);
          cc[0] = j, cc[1] = (int)(v[i].size()), cc[2] = i;
          vv.push_back(cc);
          break;
        }
      }
    }
  }
  sort(vv.rbegin(), vv.rend());
  cout << vv[0][1] << endl;
  for (int i = 0; i < (int)(v[vv[0][2]].size()); i++)
    cout << v[vv[0][2]][i] << ' ';
  return 0;
}
