n = int(input())
a = list(map(int, input().split()))
mod = 1000000007
def make_bin(i):
    return list(map(int, list(format(i, "060b"))))
def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y // 2) ** 2 % mod
    else:
        return power(x, y // 2) ** 2 * x % mod

a_bin = []
for i in range(n):
    a_bin.append(make_bin(a[i]))

ans = 0
for i in range(60):
    index_i = []
    for j in range(n):
        index_i.append(a_bin[j][i])
    ones = index_i.count(1)
    ans += (ones*(n-ones)*(power(2, 59-i))) % mod

ans %= mod
print(ans)