import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string; auto rdsp(){return readln.splitter;} void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;} void pickV(R,T...)(ref R r,ref T t){foreach(ref v;t)pick(r,v);} void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);} ulong seed; int next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); return cast(int)(seed >> 33); } const tb = 31, ub = 16, db = tb-ub; void main() { int n, q; readV(n, q, seed); foreach (i; 0..10000) next(); auto a = new int[](n); foreach (i; 0..n) a[i] = next(); auto b = new int[][](1<>db] ~= [ai]; ++c[ai>>db]; } auto cc = new int[](1<>db), r = cc[xi]; foreach (bi; b[xi]) r += bi < x; ans ^= i * r; } writeln(ans); }