#include<iostream> #include<string> #include<cstring> #include<vector> #include<algorithm> using namespace std; typedef long long ll; const int maxn = 1e5+5; ll pow2[33]; ll inp[maxn]; int main(){ int n ; scanf("%d",&n); pow2[0]=1; for(int i = 1; i<=32;i++) pow2[i]=pow2[i-1]*2; for(int i=0;i<n;i++) scanf("%lld",&inp[i]); vector<ll> v(inp,inp+n); sort(v.begin(),v.end()); ll m = v[n-1]; ll t =-1 ; for(int i = 32 ; i>=0 ; i--) if(pow2[i]<=m){ t = i; break ; } vector<ll>ans; for(int i = 0 ;i < n;i++) if(inp[i]>=pow2[t]&&inp[i]<pow2[t+1]) ans.push_back(inp[i]); printf("%d\n",ans.size()); for(int i = 0 ; i<ans.size();i++){ printf("%d",ans[i]); if(i!=ans.size()-1)printf(" "); else printf("\n"); } return 0 ; }