#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    long long int n, i, j;
    cin >> n;
    long long int a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    std::vector<long long int> ans;
    long long int last = 64 - __builtin_clzll(a[n - 1]);
    for (i = 0; i < last + 1; i++) {
      std::vector<long long int> temp;
      for (j = 0; j < n; j++) {
        bitset<70> b(a[j]);
        if (b[i]) temp.push_back(a[j]);
      }
      bool f = 0;
      for (j = i - 1; j > -1; j--) {
        bool f1 = 0;
        for (auto x : temp) {
          bitset<70> b(x);
          if (b[j] == 0) f1 = 1;
        }
        if (!f1) {
          f = 1;
          break;
        }
      }
      if (f) continue;
      if (temp.size()) {
        ans = temp;
      }
    }
    cout << ans.size() << "\n";
    for (auto x : ans) cout << x << " ";
  }
  cerr << "Time Taken:" << (float)clock() / CLOCKS_PER_SEC * 1000 << "ms"
       << "\n";
  return 0;
}
