#include <bits/stdc++.h>
using namespace std;
long long arr[100010];
vector<long long> tmp;
int main() {
  long long i, n, best, v;
  scanf("%I64d", &n);
  for (i = 0; i < n; i++) scanf("%I64d", &arr[i]);
  for (v = 31; v >= 0; v--) {
    best = (1LL << (v + 1)) - 1;
    tmp.clear();
    for (i = 0; i < n; i++)
      if ((1LL << v) & arr[i]) {
        tmp.push_back(arr[i]);
        best = best & arr[i];
      }
    if (best % (1LL << v) == 0 && tmp.size()) break;
  }
  n = tmp.size();
  printf("%I64d\n", n);
  for (i = 0; i < n; i++) printf("%I64d ", tmp[i]);
  return 0;
}
