#include <bits/stdc++.h>
using namespace std;
int main() {
  ifstream inf("input.txt");
  vector<int> a[31];
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int j, c = 0, j1;
    cin >> j;
    j1 = j;
    while (j > 0) {
      c++;
      if (j % 2 == 1) a[c].push_back(j1);
      j = int(j / 2);
    }
  }
  int j = 1;
  for (int i = 1; i <= 29; i++) j *= 2;
  for (int i = 30; i >= 1; i--) {
    int h = 0, l = a[i].size();
    if (l >= 1) h = a[i][0];
    for (int i1 = 0; i1 <= l - 1; i1++) h = h & a[i][i1];
    if (h % j == 0 && h != 0) {
      cout << l << endl;
      for (int i1 = 0; i1 <= l - 1; i1++) cout << a[i][i1] << ' ';
      return 0;
    }
    j /= 2;
  }
}
