#include #include #include #include int main() { int n, k; scanf("%d %d ", &n, &k); //int days[400001]; int * days = (int*) malloc(sizeof(int) * n+1); for (int i = 0; i < n; i++) { scanf("%d ", days + i); } std::vector> tempSums(n); for (int i = 0; i < n; i++) { tempSums[i] = std::vector(/*n-i+1*/); } int eligibleDays = 0; for (int i = 1; i <= n; i++) // pro kazdou i-tici { for (int j = 0; j < n - i + 1; j++) // kterych existuje n-i+1 { int sum; if (i == 1){ sum = 0; tempSums[j].emplace_back(sum); } else{ sum = tempSums[j][i-1]; } sum |= days[j+i-1]; tempSums[j].emplace_back(sum); if (sum == k) { eligibleDays++; } } } printf("%d\n", eligibleDays); free(days); return 0; }