#include <bits/stdc++.h>
using namespace std;
const int maxN = 100777;
const int v = (1 << 30);
int n;
int a[maxN];
vector<int> bucket[37];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int t = v, b = 30;
    while (t >= 1) {
      if (a[i] & t) {
        bucket[b].push_back(a[i]);
      }
      --b;
      t >>= 1;
    }
  }
  for (int i = 30; i >= 0; i--) {
    if (bucket[i].size() > 0) {
      int ss = bucket[i][0];
      for (int j = 1; j < bucket[i].size(); j++) {
        ss = (ss & bucket[i][j]);
      }
      if (ss % (1 << i) == 0) {
        cout << bucket[i].size() << "\n";
        for (int j = 0; j < bucket[i].size(); j++) {
          cout << bucket[i][j] << " ";
        }
        return 0;
      }
    }
  }
  assert(1 < 0);
  cout << -1 << "\n";
  return 0;
}
