#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int mx = 0, n, ar[100001];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  for (int i = 1; i <= 31; i++) {
    vector<long long int> tmp(i, 0);
    int cnt = 0;
    for (int j = 0; j < n; j++)
      if (ar[j] & (1 << i)) {
        for (int k = 0; k < i; k++)
          if (tmp[k] == 0 && ((ar[j] & (1 << k)) == 0)) cnt++, tmp[k] = 1;
      }
    if (cnt == i) mx = i;
  }
  vector<long long int> res;
  for (int i = 0; i < n; i++)
    if (ar[i] & (1 << mx)) res.push_back(ar[i]);
  if (res.size() == 0)
    cout << -1;
  else {
    cout << res.size() << '\n';
    for (int i = 0; i < res.size(); i++) cout << res[i] << ' ';
  }
}
