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