#include <bits/stdc++.h>
using namespace std;
bool comp(const pair<int, long long>& a, const pair<int, long long>& b) {
  return a.second > b.second;
}
vector<pair<int, int> > dots;
bool taken[8];
int main() {
  int n;
  cin >> n;
  int a[100010];
  for (__typeof(n) i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int p = 1073741824; p >= 1; p /= 2) {
    set<int> friends;
    int res = INT_MAX;
    if (p == 2) {
      int k = 0;
    }
    for (__typeof(n) i = 0; i < n; i++) {
      int jjj = a[i];
      int rrr = a[i] & p;
      if ((a[i] >= p) && ((a[i] & p) != 0)) {
        friends.insert(a[i]);
        res &= a[i];
      }
    }
    res -= p;
    if ((res % p) == 0) {
      cout << friends.size() << endl;
      for (__typeof((friends).begin()) it = (friends).begin();
           it != (friends).end(); it++) {
        cout << *it << " ";
      }
      return 0;
    }
  }
  cout << n << endl;
  for (__typeof(n) i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
}
