#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const string LN = "\n";
const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = (int)2e9 + 7;
const long long LINF = (long long)9e18 + 7;
bool insert(int k, int x1, int x2) { return (k >= x1 && k <= x2); }
const int MAXN = 60007;
const long long MOD = 1e9 + 7;
int n;
int a[100007];
vector<int> ans;
const bool is_testing = 0;
int main() {
  srand(3252);
  if (is_testing) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 0; j < 31; j++) {
    vector<int> q;
    int d;
    for (int i = 0; i < n; i++) {
      if ((a[i] >> j) & 1) {
        q.push_back(a[i]);
        if (q.size() == 1)
          d = a[i];
        else
          d = d & a[i];
      }
    }
    if (d % (1 << j) == 0) ans = q;
  }
  cout << ans.size() << LN;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << ' ';
}
