#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n;
  scanf("%d", &n);
  int i, j;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 30; i >= 0; i--) {
    int andnum = 2147483647;
    for (j = 0; j < n; j++) {
      if (a[j] & (1 << i)) andnum &= a[j];
    }
    if ((andnum >> i) << i != andnum) continue;
    int sum = 0;
    for (j = 0; j < n; j++) {
      if (a[j] & (1 << i)) sum++;
    }
    printf("%d\n", sum);
    for (j = 0; j < n; j++) {
      if (a[j] & (1 << i)) printf("%d ", a[j]);
    }
    return 0;
  }
  printf("%d\n", n);
  for (i = 0; i < n - 1; i++) {
    printf("%d ", a[i]);
  }
  printf("%d\n", a[i]);
  return 0;
}
