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