#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long MOD = 1e9 + 7;
long double EPS = 1e-12;
const long long INF32 = 0x3F3F3F3F;
const long long INF = 0x3F3F3F3F3F3F3F3F;
const long long crng = rng();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ifstream fin("input.txt");
  ofstream fout("output.txt");
  {
    long long n;
    cin >> n;
    vector<long long> a(n);
    for (auto &i : a) cin >> i;
    for (long long v = 32; v >= 0; v--) {
      vector<long long> b;
      for (auto i : a)
        if ((i >> v) & 1LL) b.push_back(i);
      if (b.empty()) continue;
      long long nd = b[0];
      for (auto i : b) nd &= i;
      if (nd % (1LL << v) == 0LL) {
        cout << (long long)b.size() << '\n';
        for (auto i : b) cout << i << " ";
        cout << '\n';
        return 0;
      }
    }
    cout << "-1\n";
  }
}
