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

num = 1000000007

sum = 0
for i in range(N+1):
    for j in range(i+1, N):
        sum += data[i] ^ data[j]
        if sum > num:
            sum %= num

print(sum)
