#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, l, a[111111], t;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (l = 29; l >= 0; l--) {
    k = (1 << (l + 1)) - 1;
    for (i = 1; i <= n; i++) {
      if ((a[i] & (1 << l)) > 0) {
        if (!k)
          k = a[i];
        else
          k = (k & a[i]);
        t++;
      }
    }
    if (k % (1 << l) == 0) {
      cout << t << endl;
      for (i = 1; i <= n; i++) {
        if ((a[i] & (1 << l)) > 0) {
          printf("%d ", a[i]);
        }
      }
      return 0;
    }
    t = 0;
  }
  cout << "-1";
  return 0;
}
