N = int(input())
nums = list(map(int, input().split()))

X=[]

for i in range(N-1):
    for j in range(N):
        if (j > i):
            X.append(nums[i]^nums[j])

s = sum(X)
    
print(str(s % (10**9 + 7)))