#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline int popcount(T t) {     if (std::numeric_limits<T>::digits <=         std::numeric_limits<unsigned int>::digits) {       return __builtin_popcount(t);     } else {       return __builtin_popcountll(t);     }   }   const long double EPS = 1e-8;   const long double PI = acosl(0.0) * 2;   void solve() {     int n;     cin >> n;     vector<int> a(n);     for (int i = 0; i < int(n); ++i) cin >> a[i];     for (int i = 30; i >= 0; --i) {       vector<int> b;       int mask = (1 << i) - 1;       for (int x : a) {         if ((x >> i) & 1) {           b.push_back(x);           mask &= x;         }       }       if (!mask) {         cout << b.size() << endl;         for (int x : b) {           cout << x <<    ;         }         cout << endl;         return;       }     }     assert(false);   }   int main() {     ios_base::sync_with_stdio(false);     solve();     return 0;   }   