You are given a sequence A1,A2,…,AN of length N. Count the contiguous subsequences whose XOR is less than K.
A contiguous subsequence is Ai,Ai+1,…,Aj for a pair of indices with i≤j. Its XOR is Ai⊕Ai+1⊕⋯⊕Aj, where ⊕ is the bitwise exclusive or.
Two contiguous subsequences with a different start position or a different end position count separately, even when their elements have the same values.