#include <bits/stdc++.h>
using namespace std;
int X[] = {1, 0, -1, 0}, Y[] = {0, 1, 0, -1};
string DIR = "SENW";
unsigned long long summ(unsigned long long n) { return ((n * n) + n) / 2; }
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  unsigned long long c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
double dist(long long x, long long y, long long xx, long long yy) {
  return sqrt((x - xx) * (x - xx) + (y - yy) * (y - yy));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  while (cin >> n) {
    int arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    for (int jk = 1 << 30; jk; jk /= 2) {
      int h = INT_MAX, cn = 0;
      for (int i = 0; i < n; i++) {
        if (arr[i] & jk) {
          h &= arr[i];
          cn++;
        }
      }
      bool r = 0;
      for (int i = 1; i < jk; i *= 2) {
        if (h & i) {
          r = 1;
          break;
        }
      }
      if (!r) {
        cout << cn << "\n";
        for (int i = 0; i < n; i++) {
          if (arr[i] & jk) {
            cout << arr[i] << " ";
          }
        }
        cout << "\n";
        break;
      }
    }
  }
  return 0;
}
