#include <bits/stdc++.h>
using namespace std;
int n;
int tab[100001];
int cands[100001];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> tab[i];
  }
  bool swi[32];
  for (int i = 31; i >= 0; --i) {
    for (int j = 0; j < 32; ++j) swi[j] = 0;
    int q = 1u << i;
    int nc = 0;
    for (int j = 0; j < n; ++j) {
      if (tab[j] & q) {
        for (int k = 0; k < i; ++k) {
          if ((~tab[j]) & (1u << k)) swi[k] = true;
        }
        cands[nc++] = tab[j];
      }
    }
    bool cond = nc > 0;
    for (int j = 0; j < i; ++j) {
      cond &= swi[j];
    }
    if (cond) {
      cout << nc << endl;
      for (int j = 0; j < nc; ++j) {
        cout << cands[j] << " ";
      }
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
