#include <bits/stdc++.h>
using namespace std;
struct hash_pair {
  template <class T1, class T2>
  size_t operator()(const pair<T1, T2>& p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    return hash1 ^ hash2;
  }
};
long long t;
long long mod = 1e9 + 7;
long long BigMod(long long base, long long pow, long long mod) {
  if (pow == 0 || base == 1)
    return 1;
  else if (pow == 1)
    return base;
  else if (pow % 2)
    return BigMod(base, pow - 1, mod) * base % mod;
  else {
    long long x = (BigMod(base, pow / 2, mod) % mod);
    x = (x * x) % mod;
    return x;
  }
}
vector<long long> v[32];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a, b, c, d, e, f, g, i, j;
  long long n, m, k;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    b = a;
    for (j = 0; j < 32; j++) {
      if (b % 2) {
        v[j].push_back(a);
      }
      b /= 2;
    }
  }
  for (i = 30; i >= 0; i--) {
    g = 1 << i;
    if (v[i].size() == 0) continue;
    a = v[i][0];
    for (j = 1; j < v[i].size(); j++) {
      a &= v[i][j];
    }
    if (a % g == 0) {
      cout << v[i].size() << endl;
      for (j = 0; j < v[i].size(); j++) {
        cout << v[i][j] << ' ';
      }
      cout << endl;
      return 0;
    }
  }
  return 0;
}
