#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int maxn = 5000000 + 10;
set<int> s[60];
int main() {
  int n, maxx = 0;
  cin >> n;
  while (n--) {
    int x;
    cin >> x;
    for (int i = 0; i <= 30; i++)
      if (x & (1LL << i)) s[i].insert(x);
  }
  for (int i = 30; i >= 0; i--)
    if (s[i].size()) {
      bool ok = 1;
      for (int j = i - 1; j >= 0 && ok; j--) {
        bool flag = 0;
        for (auto now : s[i])
          if (!s[j].count(now)) {
            flag = 1;
            break;
          }
        if (flag == 0) ok = 0;
      }
      if (ok) {
        cout << s[i].size() << endl;
        for (auto now : s[i]) cout << now << " ";
        break;
      }
    }
  return 0;
}
