#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
int n;
int A[100000 + 9];
int main() {
  read_file();
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i++) scanf("%d", &A[i]);
    bool found = 0;
    vector<int> ans;
    for (int j = 30 - 1; j >= 0 && !found; j--) {
      int num = (1 << 30) - 1;
      for (int i = 0; i < n; i++) {
        if ((A[i] & (1 << j)) != 0) num &= A[i];
      }
      if (num % (1 << j) == 0) {
        for (int i = 0; i < n; i++) {
          if ((A[i] & (1 << j)) != 0) ans.push_back(A[i]);
        }
        found = 1;
      }
    }
    assert(found);
    if (!found) {
      for (int i = 0; i < n; i++) ans.push_back(A[i]);
    }
    int sz = ans.size();
    printf("%d\n", sz);
    for (int i = 0; i < sz; i++) printf("%d%c", ans[i], " \n"[i == sz - 1]);
  }
}
