# coding: utf-8
mod = 10**9 + 7
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i, a1 in enumerate(A[:-1]):
    for a2 in A[i+1:]:
        # print(a1, a2, a1&a2)
        ans += a1 ^ a2
        ans = ans % mod
print(ans)