#include <bits/stdc++.h>
using namespace std;
int a[100005];
bool vis[40];
int main() {
  int i, j, k, n, m = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    m = max(m, a[i]);
  }
  j = 0;
  while (m > 0) {
    j++;
    m /= 2;
  }
  j--;
  if (j == 0) {
    cout << n << endl;
    for (i = 0; i < n; i++) cout << a[i] << " ";
    return 0;
  }
  while (j > 0) {
    for (i = 0; i < 40; i++) vis[i] = 0;
    m = 0;
    for (i = 0; i < n; i++)
      if (a[i] & (1 << j)) {
        m++;
        for (k = 0; k < 32; k++)
          if (!((1 << k) & a[i])) vis[k] = 1;
      }
    for (k = 0; k < j; k++)
      if (!vis[k]) break;
    if (k != j) {
      j--;
      continue;
    }
    cout << m << endl;
    for (i = 0; i < n; i++)
      if (a[i] & (1 << j)) cout << a[i] << " ";
    return 0;
  }
  cout << n << endl;
  for (i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
