#include <bits/stdc++.h>
using namespace std;
const int nmax = 100005;
int n;
int v[nmax];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &v[i]);
  }
  for (int b = 30; b >= 0; b--) {
    vector<int> numbers;
    int ans = 0x7fffffff;
    for (int i = 1; i <= n; i++) {
      if (v[i] & (1 << b)) {
        ans &= v[i];
        numbers.push_back(v[i]);
      }
    }
    if ((ans & ((1 << b) - 1)) == 0 && (ans & (1 << b)) == (1 << b)) {
      printf("%d\n", numbers.size());
      for (int i = 0; i < numbers.size(); i++) printf("%d ", numbers[i]);
      printf("\n");
      return 0;
    }
  }
  printf("0\n");
  return 0;
}
