import numpy as np
MOD = 10**9 + 7
def solve(n, a, p=60):
    b = [np.asarray(list(bin(x)[2:].zfill(p)), dtype=int) for x in a]
    b = np.asarray(b, dtype=int)
    s = np.sum(b, axis=0)
    res = sum(int(s[i]) * int(n - s[i]) * (2**(p-1-i)) for i in range(p))
    return res % MOD

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))