#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double eps = 1e-8;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const double pi = acos(-1.0);
const int MAX = 1000000000;
class TheGridDivTwo {
 public:
};
int arr[100001];
vector<int> cur, res;
int totalAnd, n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int mask = 0; mask < 30; mask++) {
    totalAnd = (1 << 30) - 1;
    cur.clear();
    for (int i = 0; i < n; i++) {
      if (arr[i] & (1 << mask)) {
        cur.push_back(arr[i]);
        totalAnd &= arr[i];
      }
    }
    if (totalAnd % (1 << mask) == 0) res = cur;
  }
  cout << (int)res.size() << endl;
  for (int i = 0; i < (int)res.size(); i++) cout << res[i] << ' ';
  return 0;
}
