N = int(input())
A = [int(bin(_)[2:]) for _ in list(map(int, input().split()))]
ans = 0
mod = 10 ** 9 + 7
for i in range(N - 1):
    for j in range(i + 1, N):
        Xor = list(str(A[i] + A[j]))
        for k in range(len(Xor)):
            if Xor[k] == "1":
                ans += 2**(len(Xor) - k - 1)

print(ans % mod)