#include <bits/stdc++.h>
using namespace std;
int numbers[100005];
int result[100005];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> numbers[i];
  for (int i = 30; i >= 0; i--) {
    int counter = 0;
    int mask = (1 << i) - 1;
    for (int j = 0; j < n; j++) {
      if (numbers[j] & (1 << i)) {
        mask &= numbers[j];
        result[counter++] = numbers[j];
      }
    }
    if (mask == 0) {
      cout << counter << endl;
      for (int j = 0; j < counter; j++) cout << result[j] << " ";
      return 0;
    }
  }
  return 0;
}
