#include #include #include #define DEBUG true #define $(x) {if (DEBUG) {std::cout << "(line " << __LINE__ << ") "; {x} std::cout << std::endl;}} #define _(x) {std::cout << #x << " = " << x << " ";} int main() { int N, K; std::cin >> N >> K; std::vector arr(N, 0); // std::vector bad(N, 0); int haha = 0; int total = 0; for (int i = 0; i < N; i++) { std::cin >> arr[i]; } // for (int i = 0; i < N; i++) { // haha = haha | arr[i]; // K == haha // } for (int start = 0; start < N; start++) { haha = 0; for (int end = start; end < N; end++) { haha = haha | arr[end]; // std::cout << "start: " << start << ", end: " << end << ", sum: " << sum << ", or: " << haha << " (" << (bool) (K == haha && sum >= K) << ")\n"; total += K == haha; // if (K == haha) { //// total += N - end; //// break; //total++; // } } } std::cout << total << "\n"; return 0; }