#include #include #include int main() { int n, k; scanf("%d %d ", &n, &k); int days[400001]; for (size_t i = 0; i < n; i++) { scanf("%d ", days + i); } std::vector> tempSums(n); for (size_t i = 0; i < n; i++) { tempSums[i] = std::vector(n); } 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; } else{ sum = tempSums[j][i-1]; } sum |= days[j+i-1]; tempSums[j][i] = sum; if (sum == k) { eligibleDays++; } } } printf("%d\n", eligibleDays); return 0; }