#include <bits/stdc++.h>
using namespace std;
const int Maxn = int(1e5);
inline int read() {
  char ch = getchar();
  int f = 1, x = 0;
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, a[Maxn + 5];
vector<int> v;
int main() {
  n = read();
  for (register int i = 1; i <= n; ++i) a[i] = read();
  for (register int i = 30; i >= 0; --i) {
    int now = 0, res = 0;
    v.clear();
    for (register int j = 1; j <= n; ++j)
      if (a[j] & (1 << i)) {
        now++, res &= a[j], v.push_back(a[j]);
        if (now == 1) res = a[j];
      }
    if (res % (1 << i) == 0 && now) {
      printf("%d\n", now);
      for (auto i : v) printf("%d ", i);
      return 0;
    }
  }
  printf("-1");
  return 0;
}
