#include <bits/stdc++.h>
using namespace std;
int n, a[100010];
void code() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int x = 30; x > -1; x--) {
    int tmp = (1 << (x + 1)) - 1, cnt = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] & (1 << x)) {
        tmp &= a[i];
        cnt++;
      }
    }
    if ((tmp & -tmp) == (1 << x)) {
      cout << cnt << '\n';
      for (int i = 0; i < n; i++) {
        if (a[i] & (1 << x)) {
          cout << a[i] << " ";
        }
      }
      return;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    code();
  }
}
