#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int INF = (1 << 30) - 1;
int n;
int A[100010];
int lowbit(int x) { return x & (-x); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", A + i);
  int ans = 0;
  for (int k = 30; k >= 0; --k) {
    int cur = 1 << k;
    int head = 1;
    int st = 0;
    for (int i = 1; i <= n; ++i) {
      if (A[i] & cur) {
        if (head)
          st = A[i];
        else
          st = st & A[i];
        head = 0;
      }
    }
    if (st == 0) continue;
    if (lowbit(st) % cur == 0) {
      ans = max(ans, cur);
    }
  }
  if (ans == 0) {
    printf("%d\n", n);
    for (int i = 1; i <= n; ++i) printf("%d ", A[i]);
    puts("");
    return 0;
  }
  vector<int> g;
  for (int i = 1; i <= n; ++i) {
    if (ans & A[i]) {
      g.push_back(A[i]);
    }
  }
  printf("%d\n", (int)g.size());
  for (int i = 0; i < g.size(); ++i) printf("%d ", g[i]);
  puts("");
  return 0;
}
