#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int *data = (int *)malloc(sizeof(int) * n);
  int *list = (int *)malloc(sizeof(int) * n);
  int i;
  for (i = 0; i < n; i++) {
    scanf("%d", &data[i]);
  }
  int j = 0;
  unsigned int num, temp, count;
  for (i = 30; i >= 0; i--) {
    num = (1 << 31) - 1;
    temp = 1 << i;
    count = 0;
    for (j = 0; j < n; j++) {
      if (data[j] & temp) {
        num = num & data[j];
        list[count] = data[j];
        count++;
      }
    }
    if (count > 0 && (num % temp == 0)) {
      printf("%d\n", count);
      for (j = 0; j < count - 1; j++) printf("%d ", list[j]);
      printf("%d\n", list[j]);
      return 0;
    }
  }
  return 0;
}
