#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[123456];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 30; i >= 0; i--) {
    int x = (1 << i) - 1;
    int siz = 0;
    int b[123456];
    for (int j = 0; j < n; j++) {
      if (a[j] & ((1 << i))) {
        x &= (a[j]);
        b[siz++] = a[j];
      }
    }
    if (x == 0) {
      cout << siz << endl;
      for (int j = 0; j < siz; j++) cout << b[j] << " ";
      return 0;
    }
  }
}
