#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  vector<int> ans, dp;
  for (int i = 0; i < 30; ++i) {
    int total = (1 << 30) - 1;
    dp.clear();
    for (int j = 0; j < n; ++j) {
      if (a[j] & (1 << i)) {
        total &= a[j];
        dp.push_back(a[j]);
      }
    }
    if (total % (1 << i) == 0) ans = dp;
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
