import itertools

N = int(input())
A = list(map(int, input().split()))

total = 0
mod = 10 ** 9 + 7
ls = []
max_length = len(bin(max(A))) - 2
for i in range(max_length+1):
    d = {0: 0, 1: 0}
    ls.append(d)
for i in range(N):
    idx = 0
    for j in range(max_length + 1):
        try:
            b = int(bin(A[i])[-j - 1])
        except Exception:
            b = 0
        ls[j][b] += 1
        idx += 1

ans = 0
for i in range(len(ls)):
    zero = ls[i][0]
    one = ls[i][1]
    ans += zero*one * 2**i
    ans %= mod
print(ans)
