#include #include #include using namespace std; int main(){ int N; cin >> N; assert(1 <= N && N <= 100000); vector A(N); for(int i = 0; i < N; i++){ cin >> A[i]; assert(0 <= A[i] && A[i] < (1 << 30)); } atcoder::fenwick_tree dp(N); dp.add(0, 1); vector prev(30, -1); for(int i = 0; i < N; i++){ for(int j = 0; j < 30; j++){ if(A[i] >> j & 1){ prev[j] = i; } } auto idx = prev; sort(idx.begin(), idx.end()); idx.erase(unique(idx.begin(), idx.end()), idx.end()); for(int j = (int)idx.size() - 1; j >= 0; j--){ if(idx[j] != i){ dp.add(idx[j] + 1, dp.sum(0, idx[j] + 1)); } } } cout << dp.sum(0, N).val() << endl; }