#include <bits/stdc++.h>
using namespace std;
int i, j, n, a[100005], MOD, now;
vector<int> rs;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (i = 1; i <= n; ++i) cin >> a[i];
  reverse(a + 1, a + n + 1);
  for (j = 30; j >= 0; --j) {
    now = (1 << 30) - 1;
    MOD = (1 << j);
    rs.clear();
    for (i = 1; i <= n; ++i)
      if (a[i] & MOD) now &= a[i], rs.push_back(a[i]);
    if (now % MOD) continue;
    cout << rs.size() << '\n';
    for (auto it : rs) cout << it << ' ';
    j = -1;
  }
  return 0;
}
