#include <bits/stdc++.h>
using namespace std;
inline long long minOf(long long x, long long y) { return (x < y ? x : y); }
inline long long maxOf(long long x, long long y) { return (x > y ? x : y); }
char arr[50000000], *ptr;
long long ret;
string str;
inline long long get_int() {
  bool isNeg = false;
  ret = 0;
  while (!((*ptr >= '0' && *ptr <= '9') || *ptr == '-')) ptr++;
  while ((*ptr >= '0' && *ptr <= '9') || *ptr == '-') {
    if (*ptr == '-')
      isNeg = true;
    else
      ret = ret * 10 + (*ptr - '0');
    ptr++;
  }
  if (isNeg) ret = -ret;
  return ret;
}
long long a[100005];
int bits[33];
int main() {
  fread(arr, sizeof(char), 50000000, stdin);
  ptr = arr;
  int n = get_int();
  for (int i = 0; i < 33; i++) bits[i] = -1;
  for (int i = 0; i < n; i++) {
    a[i] = get_int();
    for (int j = 0; j < 32; j++) {
      if (a[i] & (1 << j)) {
        if (bits[j] == -1)
          bits[j] = a[i];
        else
          bits[j] = a[i] & bits[j];
      }
    }
  }
  int k = 0;
  vector<int> list;
  int lk = 0;
  for (int i = 32; i >= 0; i--) {
    if (bits[i] != -1) {
      for (int j = 0; j < 32; j++) {
        if (bits[i] & (1 << j)) {
          if (j > lk) lk = j;
          break;
        }
      }
    }
  }
  for (int j = 0; j < n; j++) {
    if (a[j] & (1 << lk)) {
      k++;
      list.push_back(a[j]);
    }
  }
  cout << k << endl;
  for (int i = 0; i < k; i++) {
    cout << list[i] << " ";
  }
  return 0;
}
