#include using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define ll long long const long long mod=998244353; const long long hmod=46216567629137; int main(){ cin.tie(0)->sync_with_stdio(0); cout.tie(0); int N; cin>>N; ll H[N+1]; for(int i=1;i<=N;i++) cin>>H[i]; priority_queue,greater>PQ; for(int i=1;i<=N;i++){ int c=0; for(int j=0;j<60;j++){ if(H[i]>>j&1) c=j; } c++; PQ.push(c); } int ans=0; while(!PQ.empty()){ while(true){ if(PQ.empty()) break; ans++; if(PQ.top()<=ans){ PQ.pop(); } } } cout<