#include <bits/stdc++.h>
using namespace std;
long long n, a[100009], x;
vector<long long> v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 30; i >= 0; i--) {
    x = (1 << (i + 1)) - 1;
    for (long long j = 0; j < n; j++)
      if ((a[j] & x) >= (1 << i)) {
        v.push_back(a[j]);
        x &= a[j];
      }
    if (x == (1 << i)) break;
    v.clear();
  }
  cout << v.size() << endl;
  for (auto z : v) cout << z << " ";
  return 0;
}
