#include <bits/stdc++.h>
int a[200000], s[200000], n, p, q, t;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 30; i >= 0; i--) {
    t = (1 << 31) - 1;
    p = 0;
    for (int j = 1; j <= n; j++)
      if ((a[j] >> i) % 2 == 1) {
        t &= a[j];
        p++;
        s[p] = a[j];
      }
    if (t % (1 << i) == 0) {
      printf("%d\n", p);
      for (int j = 1; j <= p; j++) printf("%d ", s[j]);
      break;
    }
  }
  return 0;
}
