#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  vector<int> res;
  for (int i = 31; i >= 0; --i) {
    res.erase(res.begin(), res.end());
    int t = (1LL << 31) - 1;
    for (int j = 0; j < n; ++j) {
      if ((v[j] & (1 << i)) != 0) {
        t &= v[j];
        res.push_back(v[j]);
      }
    }
    if ((t & ((1 << i) - 1)) == 0) {
      cout << res.size() << endl;
      for (auto k : res) {
        cout << k << " ";
      }
      return 0;
    }
  }
}
