#include <bits/stdc++.h>
int V[33][100005];
int siz[33];
int main() {
  int n, i, j, jmax = -1;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    int tt = t;
    for (j = 0; t; j++) {
      if (t & 1) {
        V[j][siz[j]] = tt;
        siz[j]++;
      }
      t /= 2;
    }
  }
  for (i = 32; i >= 0; i--) {
    if (siz[i] == 0) continue;
    int t = V[i][0];
    for (j = 1; j < siz[i]; j++) t &= V[i][j];
    if (t % (1 << i) == 0) {
      printf("%d\n", siz[i]);
      for (j = 0; j < siz[i]; j++) {
        printf("%d ", V[i][j]);
      }
      return 0;
    }
  }
  printf("-1");
}
