Give you an array $A[1..n]$, you need to calculate how many tuples $(i,j,k)$ satisfy that $(i<j<k)$ and $((A[i]~xor~A[j])<(A[j]~xor~A[k]))$
There are T test cases.
<j<k)$ and="" $((a[i]~xor~a[j])<(a[j]~xor~a[k]))$
$1\leq T\leq 20$
$1\leq \sum n\leq 5*10^5$
$0\leq A[i] <2^{30}$</j<k)$>