#include <bits/stdc++.h>
const int MAXN = 100010;
int n, a[MAXN], b[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 30; i >= 0; i--) {
    int tmp = (1 << i) - 1;
    b[0] = 0;
    for (int j = 1; j <= n; j++)
      if (a[j] & (1 << i)) {
        tmp &= a[j];
        b[++b[0]] = a[j];
      }
    if (!tmp) {
      printf("%d\n", b[0]);
      for (int j = 1; j <= b[0]; j++) printf("%d ", b[j]);
      return 0;
    }
  }
  return 0;
}
