#problem4
N = int(input())
numbers = list(map(int, input().split()))

sum=0
for i in range(1,N):
    for j in range(i+1,N+1):
        s=numbers[i-1]^numbers[j-1]
        sum=sum+s

ans = sum%(10**9+7)
print(ans)