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 = 0
    for i in reversed(range(len(w))):
        if w[i] == "1":
            ans += 2**(len(w)-1-i)
    return ans


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