#include <bits/stdc++.h>
using namespace std;
int a[111111];
int t[111111];
int n, maxbeauty, maxcnt, bestbit;
int V = (1 << 30) - 1;
void read_input() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
}
void write_output() {
  printf("%d\n", maxcnt);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if ((a[i] / (1 << bestbit)) % 2 == 1) {
      cnt++;
      printf("%d%s", a[i], (cnt < maxcnt) ? " " : "\n");
    }
  }
}
void solve() {
  for (int i = 0; i < n; i++) t[i] = a[i];
  for (int bit = 0; 1 << bit <= a[n - 1]; bit++) {
    int ad = V, cnt = 0;
    ;
    for (int i = 0; i < n; i++) {
      if (t[i] % 2 == 1) {
        ad &= a[i];
        cnt++;
      }
      t[i] /= 2;
    }
    int beauty = 0;
    while (ad % 2 == 0) {
      beauty++;
      ad /= 2;
    }
    if (beauty > maxbeauty || (beauty == maxbeauty && cnt > maxcnt)) {
      bestbit = bit;
      maxbeauty = beauty;
      maxcnt = cnt;
    }
  }
}
int main() {
  read_input();
  solve();
  write_output();
  return 0;
}
