#include <bits/stdc++.h>
using namespace std;
int a[100010];
int b[100];
int c[100];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 29; i >= 0; i--) {
    int t = (1 << (i + 1)) - 1;
    int num = 0;
    for (int j = 1; j <= n; j++)
      if (a[j] & (1 << i)) {
        num++;
        t &= a[j];
      }
    if (t % (1 << i) == 0) {
      cout << num << endl;
      for (int j = 1; j <= n; j++)
        if (a[j] & (1 << i)) printf("%d ", a[j]);
      return 0;
    }
  }
  return 0;
}
