#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100010];
  int m, b[100010];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 29; i >= 0; i--) {
    int x = (1 << 30) - 1;
    int y = x & 1 << i;
    m = 0;
    for (int j = 0; j < n; j++) {
      if (y & a[j]) {
        x &= a[j];
        b[m++] = a[j];
      }
    }
    if (__builtin_ctz(x) == i) {
      printf("%d\n", m);
      for (int i = 0; i < m; i++) printf("%d ", b[i]);
      break;
    }
  }
}
