#include using namespace std; int a[100000]; int count(int s,int e,int b) { int u1=0,u2=0,m=~(b*2-1); int i=s,j=e; while ( i<=j ) { while ( i<=j&&!(a[i]&b) ) u1|=a[i++]&m; while ( i<=j&& (a[j]&b) ) u2|=a[j--]&m; if ( ie ? 0 : i==e ? 1 : u2 ? count(i,e,b*2) : 0; return c; } int main(void) { int n; scanf("%d",&n); int x,i=-1,j=n; while ( i+1