Amit is going on a date and he wants to gift his date an array of positive numbers. But he is running short on money. He already has an array of numbers in design. Cost of an array of numbers is the sum of elements in it. But he wants to minimize the cost of making it. 
So he does the following number of operations one by one for any number of times:
He chooses two adjacent elements ,replace them by one element with value = XOR of the two numbers. This operation reduces length of array (and elements are re-numerated accordingly)
Find the minimum amount of money that Amit needs to spend to gift his date.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of $2$ lines of input, first line contains a single integer $N$ and the second line contains $N$ elements - $A1,A2,A3,.....,AN$ 

-----Output:-----
For each testcase, output in a single line answer denoting the minimum cost

-----Constraints-----
- $1 \leq T \leq 10$
- $1 \leq N \leq 10^5$
- $0 \leq Ai \leq 10^9$ for $1\leq i \leq N$

-----Sample Input:-----
3
5
8 4 1 5 0
5
1 2 4 0 8
2
10 10

-----Sample Output:-----
8
15
0

-----EXPLANATION:-----
For first case,
This array is :
$[8,4,1,5,0] -> [8,4,4,0] -> [8,0,0]$. Sum=$8$ So the answer is 8.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 't=int(input())\r\n\r\nfor t1 in range(t):\r\n    n=int(input())\r\n    a=list(map(int,input().split()))\r\n    s=bin(a[0])[2:]\r\n    s1=a[0]\r\n    for i in range(1,n):\r\n        x=bin(a[i])[2:]\r\n        \r\n        if len(s)>len(x):\r\n            j=1\r\n            s1=\'\'\r\n            while j<=len(x):\r\n                if s[-j]==x[-j]:\r\n                    s1+="0"\r\n                else:\r\n                    s1+="1"\r\n                j+=1\r\n            \r\n            while j<=len(s):\r\n                s1+=s[-j]\r\n                j+=1\r\n            \r\n            s=s1[::-1]\r\n        else:\r\n            j=1\r\n            s1=\'\'\r\n            while j<=len(s):\r\n                if s[-j]==x[-j]:\r\n                    s1+="0"\r\n                else:\r\n                    s1+="1"\r\n                j+=1\r\n\r\n            while j<=len(x):\r\n                s1+=x[-j]\r\n                j+=1\r\n            \r\n            s=s1[::-1]\r\n            \r\n    s="0b"+s\r\n    print(int(s,2))\r\n\r\n                \r\n\r\n\r\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13705