#include <bits/stdc++.h>
using namespace std;
int a[200000], m[200000][50], mj;
bool mark[50];
vector<int> Ans;
int main() {
  int n, ans = -1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int now = a[i], j = 0;
    while (now) {
      m[i][j++] = now % 2;
      now /= 2;
    }
    mj = max(mj, j);
  }
  for (int i = mj; i >= 0; i--) {
    for (int j = 0; j < n; j++)
      if (m[j][i] == 1)
        for (int y = 0; y <= mj; y++)
          if (m[j][y] == 0) mark[y] = 1;
    bool flag = 0;
    for (int j = 0; j < i; j++)
      if (j != i && !mark[j]) flag = 1;
    for (int j = 0; j <= mj; j++) mark[j] = 0;
    if (!flag) {
      ans = i;
      break;
    }
  }
  for (int i = 0; i < n; i++)
    if (m[i][ans] == 1) Ans.push_back(a[i]);
  cout << Ans.size() << endl;
  for (int i = 0; i < Ans.size(); i++) cout << Ans[i] << " ";
  cin >> n;
}
