#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int M = 30;
int n, a[N], que[N];
bool check(int v) {
  int k = 0;
  for (int i = (1); i < (n + 1); ++i)
    if (a[i] >> v & 1) {
      que[k++] = a[i];
    }
  if (k == 0) return false;
  int ret = que[0];
  for (int i = (1); i < (k); ++i) ret &= que[i];
  if (ret ^ ((ret >> v) << v)) return false;
  printf("%d\n", k);
  for (int i = (0); i < (k); ++i) {
    if (i) putchar(' ');
    printf("%d", que[i]);
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = (1); i < (n + 1); ++i) scanf("%d", &a[i]);
  bool flag = false;
  for (int v = M - 1; v >= 0; --v)
    if (check(v)) {
      flag = true;
      break;
    }
  if (!flag) {
    puts("-1");
  }
  return 0;
}
