#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238;
template <typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vector) {
  for (size_t i = 0; i < vector.size(); ++i) {
    os << vector[i] << " ";
  }
  return os;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const set<T>& st) {
  for (typename set<T>::iterator it = st.begin(); it != st.end(); ++it) {
    os << (*it) << " ";
  }
  return os;
}
int GetNumBinaryDigits(int x) {
  if (x == 0) {
    return 1;
  }
  int res = 0;
  while (x > 0) {
    x >>= 1;
    ++res;
  }
  return res;
}
int GetBeauty(int x) {
  if (x == 0) {
    return -1;
  }
  int otv = 0;
  while ((x & 1) == 0) {
    ++otv;
    x >>= 1;
  }
  return otv;
}
bool IsContain(int x, int k) { return GetNumBinaryDigits(x) >= k + 1; }
int n;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < (int)(n); ++i) {
    cin >> v[i];
  }
  int k_res = -1;
  int size_res = -1;
  for (int k = 29; k >= 0; --k) {
    int res = (1 << 30) - 1;
    int size = 0;
    for (int i = 0; i < (int)(n); ++i) {
      if (v[i] & (1 << k)) {
        res = (res & v[i]);
        ++size;
      }
    }
    if (res % (1 << k) == 0) {
      k_res = k;
      size_res = size;
      break;
    }
  }
  cout << size_res << "\n";
  for (int i = 0; i < (int)(n); ++i) {
    if (v[i] & (1 << k_res)) {
      cout << v[i] << " ";
    }
  }
  cout << "\n";
  return 0;
}
