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