#include <bits/stdc++.h>
using namespace std;
vector<int> output, temp1;
int arr[100010];
int main() {
  int n;
  cin >> n;
  int max = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    max |= arr[i];
  }
  for (int j = 31; j >= 0; j--) {
    int temp = max;
    for (int i = 0; i < n; i++)
      if (arr[i] & (1LL << j)) {
        temp1.push_back(arr[i]);
        temp &= arr[i];
      }
    if (temp1.size() && temp % (1LL << j) == 0) {
      if (output.size() < temp1.size()) output = temp1;
      break;
    }
    temp1.clear();
  }
  if (output.size()) {
    cout << output.size() << endl;
    for (int i = 0; i < output.size(); i++) {
      cout << output[i];
      if (i + 1 != output.size()) cout << " ";
    }
  } else
    cout << "-1";
  cout << endl;
  return 0;
}
