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

num = 0
for i in range(N - 1):
    if N - i > 0:
        for j in range(N - i):
            num += int(bin(A[i] ^ A[j + i]), 2)
    else:
        break

result = num % (10^9 + 7)
print(result)