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


def xor(x, y):
    X = bin(max(x, y))[2:]
    Y = bin(min(x, y))[2:]
    w = str(int(X)+int(Y))
    ans = ""
    for i in range(len(w)):
        if w[i] != "1":
            w = w[:i] + "0" + w[i+1:]
    return int("0b" + w, 2)


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