#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  set<long long> aset;
  bool k = 1;
  cin >> n;
  long long a[100009];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 30; i >= 0; i--) {
    bool d = 1;
    long long s;
    set<long long> v;
    for (int j = 0; j < n; j++) {
      if (((1 << i) & a[j]) != 0) {
        if (d) {
          s = a[j];
          d = 0;
        } else {
          s = (s & a[j]);
        }
        v.insert(a[j]);
      }
    }
    if (d == 0 && s != 0 && s % (1 << i) == 0) {
      cout << v.size() << endl;
      for (set<long long>::iterator it = v.begin(); it != v.end(); it++)
        cout << *it << " ";
      return 0;
    }
  }
  return 0;
}
