import itertools
n = int(input())
a = list(map(int, input().split()))
mod = 10**9 + 7
Ans = 0


def xor(x, y):
    X = bin(max(x, y))
    Y = bin(min(x, y))
    w = int(X) ^ int(Y)

    return int(w, 2)


for i in itertools.combinations(a, 2):
    Ans = Ans + xor(i[0], i[1])

print(Ans % mod)
