#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000005;
int a[maxn];
int main() {
  int n, cnt, tmp, now;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 30; i >= 0; i--) {
    now = (1 << 30) - 1;
    cnt = 0;
    for (int j = 0; j < n; j++) {
      if ((a[j] & (1 << i)) != 0) {
        now &= a[j];
        cnt++;
      }
    }
    if ((now % (1 << i) == 0) && (now != 0)) {
      cout << cnt << endl;
      for (int j = 0; j < n; j++) {
        if ((a[j] & (1 << i)) != 0) {
          cout << a[j] << " ";
        }
      }
      cout << endl;
      return 0;
    }
  }
  cout << n << endl;
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
