#include #include #define STEP 100 using namespace std; int n,q,A[200010]; unsigned long long seed; long long ans; int next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); return (seed >> 33); } int main() { int i,x,y,z,last; scanf("%d%d%llu",&n,&q,&seed); for(i=0;i<10000;i++) next(); for(i=1;i<=n;i++) A[i] = next(); sort(A+1,A+n+1); A[n+1] = (1LL<<31) - 1; for(i=0;i n) y = n; for(z=STEP,last=-1;!(A[y]=x);) { if(y > 0 && A[y] >= x) { y -= z; if(y < 0) y = 0; if(last == 1) z = (z+1)>>1; last = 0; } else if(y < n && A[y+1] < x) { y += z; if(y > n) y = n; if(last == 0) z = (z+1)>>1; last = 1; } } ans ^= 1LL*i*y; } printf("%lld",ans); return 0; }