#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a[100005];
  cin >> n;
  for (int i = 0; i < int(n); ++i) cin >> a[i];
  for (int i = 31; i--;) {
    long long int k = 0, ans = 1 << i, b[100005];
    for (int j = 0; j < int(n); ++j) {
      if ((ans & a[j]) == ans) b[k++] = a[j];
    }
    long long int ans1 = (1 << 31) - 1;
    for (int j = 0; j < int(k); ++j) {
      ans1 &= b[j];
    }
    ans1 = (ans1 & (-ans1));
    if (ans == ans1) {
      cout << k << "\n";
      for (int j = 0; j < int(k); ++j) cout << b[j] << " ";
      break;
    }
  }
  return 0;
}
