n = int(input())
a = list(map(int, input().split()))
import itertools

def xor(x, y):
    X = bin(max(x, y))
    Y = bin(min(x, y))
    s = len(X)
    l = len(Y)
    ans = ""
    for k in range(2, 2+s-l):
        ans += X[k]
    for i in range(2, l):
        ans += str(int(X[i+s-l]) ^ int(Y[i]))

    return int(ans, 2)


Ans = 0
mod = 10**9 + 7
for i in itertools.combinations(a, 2):
        Ans = (Ans + xor(i[0], i[1])) % mod
print(Ans)
