n = int(input())
a = []
for i in input().split():
    a.append(int(i))
ans = 0
MOD = 1e9 + 7
for i in range(n - 1):
    for j in range(i + 1, n):
        ans += a[i] ^ a[j]
        ans = int(ans % MOD)
print(ans)