#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double pi = acos(-1.0);
int a[100010];
int main() {
  int n, i, now, temp, j, flag = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 30; i >= 0; i--) {
    now = (1 << 30) - 1;
    temp = 0;
    for (j = 1; j <= n; j++) {
      if ((1 << i) & a[j]) {
        now = now & a[j];
        temp++;
      }
    }
    if (now % (1 << i) == 0 && temp > 0) {
      flag = 1;
      printf("%d\n", temp);
      for (j = 1; j <= n; j++) {
        if ((1 << i) & a[j]) printf("%d ", a[j]);
      }
      printf("\n");
    }
    if (flag == 1) break;
  }
  return 0;
}
