#include <bits/stdc++.h>
static const int INF = std::numeric_limits<int>::max();
int main() {
  int n;
  std::cin >> n;
  auto v = std::vector<int>(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> v[i];
  }
  for (int i = 30; i >= 0; --i) {
    int a = (1 << 30) - 1;
    for (int j = 0; j < n; ++j) {
      if (v[j] & (1 << i)) {
        a &= v[j];
      }
    }
    if ((a % (1 << i)) == 0) {
      std::vector<int> res;
      for (int j = 0; j < n; ++j) {
        if (v[j] & (1 << i)) {
          res.push_back(v[j]);
        }
      }
      std::cout << res.size() << std::endl;
      for (auto x : res) {
        std::cout << x << " ";
      }
      std::cout << std::endl;
      break;
    }
  }
}
