#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    vector<long long> nums(n);
    for (int i = 0; i < n; i++) {
      cin >> nums[i];
    }
    bool hasAns = false;
    for (int i = 31; i >= 0; i--) {
      long long num = 1;
      num = num << i;
      bool hasRes = false;
      long long res = 0;
      int count = 0;
      for (int j = 0; j < nums.size(); j++) {
        if (nums[j] & num) {
          if (hasRes) {
            res &= nums[j];
          } else {
            res = nums[j];
          }
          count++;
          hasRes = true;
        }
      }
      if (count == 0 || (res % num)) {
        continue;
      }
      hasAns = true;
      cout << count << endl;
      for (int j = 0; j < nums.size(); j++) {
        if (nums[j] & num) {
          cout << nums[j] << " ";
        }
      }
      cout << endl;
      break;
    }
    if (!hasAns) {
      cout << nums.size() << endl;
      for (int j = 0; j < nums.size(); j++) {
        cout << nums[j] << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
