//#define _GLIBCXX_DEBUG #include using namespace std; #define endl '\n' #define lfs cout<= (ll)(n); i--) using ll = long long; using ld = long double; const ll MOD1 = 1e9+7; const ll MOD9 = 998244353; const ll INF = 1e18; using P = pair; templatebool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;} templatebool chmax(T1 &a,T2 b){if(avoid ans(bool x,T1 y,T2 z){if(x)cout<void debug(vector>&v,ll h,ll w){for(ll i=0;i&v,ll h,ll w){for(ll i=0;ivoid debug(vector&v,ll n){if(n!=0)cout<vector>vec(ll x, ll y, T w){vector>v(x,vector(y,w));return v;} ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;} vectordx={1,-1,0,0,1,1,-1,-1};vectordy={0,0,1,-1,1,-1,1,-1}; templatevector make_v(size_t a,T b){return vector(a,b);} templateauto make_v(size_t a,Ts... ts){return vector(a,make_v(ts...));} templateostream &operator<<(ostream &os, const pair&p){return os << p.first << " " << p.second;} templateostream &operator<<(ostream &os, const vector &v){for(auto &z:v)os << z << " ";cout<<"|"; return os;} //mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); template struct BinaryTrie{ struct Node{ Node* next[2]; ll num; S sum; Node(S iden):num(0), sum(iden), next{nullptr, nullptr}{}; }; S iden; T rev; Node* root; bitsetbit,bit2; BinaryTrie(S iden):iden(iden){ rev = 0; root = new Node(iden); } void insert(T x, ll add, S adds){ Node* pos = root; bit = rev^x; for(int i=size-1;i>=0;i--){ if(pos->next[bit[i]]==nullptr){ pos->next[bit[i]] = new Node(iden); } pos->num += add; pos->sum += adds; pos = pos->next[bit[i]]; } pos->num += add; pos->sum+=adds; } void erase(T x, ll add, S adds){ Node* pos = root; bit = rev^x; for(int i=size-1;i>=0;i--){ pos->num -= add; pos->sum -= adds; pos = pos->next[bit[i]]; } pos->num -= add; } void xor_all(T x){ rev ^= x; } T max_element(){ Node* pos = root; bit = ~rev; T val = 0; for(ll i=size-1;i>=0;i--){ if(pos->next[bit[i]] != nullptr && pos->next[bit[i]]->num >= 1){ pos = pos->next[bit[i]]; val ^= T(1) << i; } else pos = pos->next[!bit[i]]; } return val ^ rev; } T min_element(){ Node* pos = root; bit = rev; T val = 0; for(ll i=size-1;i>=0;i--){ if(pos->next[bit[i]] != nullptr && pos->next[bit[i]]->num >= 1){ pos = pos->next[bit[i]]; } else{ pos = pos->next[!bit[i]]; val ^= 1 << i; } } return val; } T kth_element(ll k){//下からk番目、0-indexed Node* pos = root; bit = rev; T val = 0; for(ll i=size-1;i>=0;i--){ if(pos->next[bit[i]] != nullptr && pos->next[bit[i]]->num > k){ pos = pos->next[bit[i]]; } else{ if(pos->next[bit[i]] != nullptr)k -= pos->next[bit[i]]->num; val ^= T(1) << i; pos = pos->next[!bit[i]]; } } return val ^ rev; } ll num_all(){ return root->num; } S count_lower(T x){ //x未満のnumの合計 Node* pos = root; S ret=iden; bit = rev; bit2 = x; for(ll i=size-1;i>=0;i--){ if(bit2[i]&&pos->next[bit[i]] != nullptr)ret += pos->next[bit[i]]->sum; if(pos->next[bit2[i]^bit[i]] != nullptr)pos = pos->next[bit2[i]^bit[i]]; else break; } return ret; } ll lower_bound(T x){ ll idx = count_lower(x); if(idx == num_all())return -1; else return kth_element(idx); } ll upper_bound(T x){ return lower_bound(x + 1); } }; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll res=0,buf=0; bool judge = true; ll n,x;cin>>n>>x; const ll sz=20; struct A{ array,sz>ar; A &operator+=(A &x){ rep(j,0,2)rep(i,0,sz)ar[i][j]+=x.ar[i][j]; return *this; } }; A iden; rep(i,0,sz)rep(j,0,2)iden.ar[i][j]=0; BinaryTrietri(iden); vectora(n); rep(i,0,n){ cin>>a[i]; tri.xor_all(a[i]); auto t=tri.count_lower(x); tri.xor_all(a[i]); A ins=iden; rep(j,0,sz){ res+=t.ar[j][1]*(1<