#include #include #include #include int main() { int days; int bulls_pay; std::cin >> days >> bulls_pay; std::list xors; // xors.reserve(days); int found = 0; int num; for (int i = 0; i < days; i++) { std::cin >> num; std::forward_list::const_iterator> remove; for (auto it = xors.begin(); it != xors.end(); it++) { int &xnum = *it; xnum |= num; if (xnum > bulls_pay) remove.push_front(it); else if (xnum == bulls_pay) found++; } for (auto rem : remove) xors.erase(rem); if (num == bulls_pay) found++; if (num <= bulls_pay) xors.push_front(num); } std::cout << found << std::endl; return 0; }