#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include using namespace std; typedef long long ll; void fwt(vector& f) { int n = f.size(); for (int i = 1; i < n; i <<= 1) { for (int j = 0; j < n; j++) { if ((j & i) == 0) { ll x = f[j], y = f[j | i]; f[j] = x + y, f[j | i] = x - y; } } } } void ifwt(vector& f) { int n = f.size(); for (int i = 1; i < n; i <<= 1) { for (int j = 0; j < n; j++) { if ((j & i) == 0) { ll x = f[j], y = f[j | i]; f[j] = (x + y) / 2, f[j | i] = (x - y) / 2; } } } } vector cnt1(1<<18),cnt2(1<<18); int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); ll i,j,k,n,x; cin >> n >> x; vector a(n); for(i=0;i> a[i]; ll ans = 0; for(j=0;j<18;j++){ for(i=0;i<(1<<18);i++) cnt1[i] = cnt2[i] = 0; for(i=0;i>j)&1)) cnt1[a[i]]++; cnt2[a[i]]++; } fwt(cnt1); fwt(cnt2); for(i=0;i<(1<<18);i++){ cnt1[i] *= cnt1[i]; cnt2[i] *= cnt2[i]; } ifwt(cnt1); ifwt(cnt2); ll sum1 = 0,sum2 = 0; for(i=0;i