#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int maxn = 100000;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 30; i >= 0; i--) {
    bool vis[32] = {0}, check = true;
    vector<long long int> v;
    for (long long int j = 0; j < n; j++) {
      if (a[j] >> i & 1) v.push_back(a[j]);
    }
    if (v.size() > 0) {
      for (long long int j = 0; j < v.size(); j++) {
        for (long long int k = i - 1; k >= 0; k--) {
          if (!(v[j] >> k & 1)) {
            vis[k] = 1;
          }
        }
      }
      for (long long int j = i - 1; j >= 0; j--) {
        if (vis[j] != 1) {
          check = false;
          break;
        }
      }
      if (check == true) {
        cout << v.size() << '\n';
        for (auto x : v) {
          cout << x << " ";
        }
        return 0;
      }
    }
  }
}
