#include <bits/stdc++.h>
using namespace std;
int n, a[111111];
vector<int> b, c;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) scanf("%d", &a[i]);
  for (int v = (30) - 1; 0 <= v; --v) {
    b.clear();
    int dan = 2147483647, last;
    for (int i = 0; i < (n); ++i)
      if ((1 << v) & a[i]) {
        b.push_back(a[i]);
        dan &= a[i];
      }
    if (b.empty()) continue;
    last = dan & ((1 << v) - 1);
    c.clear();
    for (__typeof((b).begin()) it = (b).begin(); it != (b).end(); it++)
      if (!((*it) & last)) {
        c.push_back(*it);
        dan &= *it;
      }
    if (!c.empty()) {
      printf("%d\n", ((int)(c).size()));
      for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
        printf("%d ", *it);
      puts("");
      return 0;
    }
  }
  puts("-1");
  return 0;
}
