basis = []
def add(x):
    global basis
    for i in basis:
        x = min(x,x^i)
    if(x>0):
        basis.append(x)
class Solution:
    def solve(self, A):
        global basis
        basis = []
        for num in A:
            add(num)
        basis.sort(reverse = True)
        for i in range(len(basis)):
            for j in range(i+1,len(basis)):
                basis[i] = min(basis[i],basis[i]^basis[j])
        return sum(basis)%(10^9+7)