从网上复制来的快读不知道为什么本地正确提交wa改用cin就过了
#include<iostream>
using namespace std;
int n,k,dp[31],ans,stack[32],top;
void write(int x) {
static int sta[15];
int top1 = 0;
do {
sta[top1++] = x % 10, x /= 10;
} while (x);
while (top1) putchar(sta[--top1] + 48);
}
inline int read() {
int x = 0;
char ch = 0;
while (ch < '0' || ch > '9') {
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return x;
}
int main(){
n=read();
while(n--){
k=read();
top=ans=0;
for(int i=0;i<32;i++){
if(k&(1<<i)){
stack[++top]=i;
if(ans<dp[i])
ans=dp[i];
}
}
for(int i=1;i<=top;i++){
dp[stack[i]]=ans+1;
}
}
ans=0;
for(int i=0;i<32;i++)
if(dp[i]>ans)
ans=dp[i];
write(ans);
return 0;
}