#include <bits/stdc++.h>
using namespace std;
int a[200000], num;
int test(int place) {
  int initial = -1;
  int count = 0;
  for (int i = 0; i < num; ++i) {
    if (a[i] & (1 << place)) {
      initial &= a[i];
      ++count;
    }
  }
  for (int i = 0; i < place; ++i) {
    if (initial & (1 << i)) {
      count = -1;
    }
  }
  if (initial == 0) {
    count = -1;
  }
  if (count == 0) {
    count = -1;
  }
  return count;
}
void print(int shift, int count) {
  if (count == -1) {
    cout << num << endl;
    for (int i = 0; i < num; ++i) {
      cout << a[i] << " ";
    }
    return;
  }
  cout << count << endl;
  for (int i = 0; i < num; ++i) {
    if (a[i] & (1 << shift)) {
      cout << a[i] << " ";
    }
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> num;
  for (int i = 0; i < num; ++i) {
    cin >> a[i];
  }
  int count = -1;
  int bsft = -1;
  for (int shift = 0; shift < 32; ++shift) {
    int cand = test(shift);
    if (cand != -1) {
      count = cand;
      bsft = shift;
    }
  }
  print(bsft, count);
  return 0;
}
