#include #include #include #include #include void test(int bulls_pay, int num, std::vector &primary, std::vector &secondary, int &found) { secondary.clear(); for (int &xnum : primary) { xnum |= num; if (xnum > bulls_pay) continue; if (xnum == bulls_pay) found++; secondary.push_back(xnum); } if (num == bulls_pay) found++; if (num <= bulls_pay) secondary.push_back(num); } int main() { int days; int bulls_pay; std::cin >> days >> bulls_pay; std::vector xors1; std::vector xors2; xors1.reserve(days); xors2.reserve(days); int found = 0; int num; for (int i = 0; i < days; i++) { std::cin >> num; if (i % 2 != 0) test(bulls_pay, num, xors1, xors2, found); else test(bulls_pay, num, xors2, xors1, found); } std::cout << found << std::endl; return 0; }