#include <bits/stdc++.h>
using namespace std;
bool xdy(double x, double y) { return x > y + 1e-6; }
bool xddy(double x, double y) { return x > y - 1e-6; }
bool xcy(double x, double y) { return x < y - 1e-6; }
bool xcdy(double x, double y) { return x < y + 1e-6; }
int min3(int x, int y, int z) {
  int tmp = min(x, y);
  return min(tmp, z);
}
int max3(int x, int y, int z) {
  int tmp = max(x, y);
  return max(tmp, z);
}
int n;
int x[100005];
int main() {
  ios_base::sync_with_stdio(0);
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) scanf("%d", &x[i]);
    for (int i = 30; i >= 0; i--) {
      int y = 1 << i;
      int num = 0, s = -1;
      int ans[100005];
      for (int j = 0; j < n; j++) {
        if ((x[j] & y) != 0) {
          if (s == -1) {
            s = x[j];
            ans[num++] = x[j];
          } else {
            s &= x[j];
            ans[num++] = x[j];
          }
        }
      }
      if (s % y == 0) {
        printf("%d\n", num);
        for (int j = 0; j < num; j++) printf("%d ", ans[j]);
        printf("\n");
        break;
      }
    }
  }
}
